Jump to content

how to transfer from a form to another form?..


arden

Recommended Posts

hi.. im a newbie in php..i want to know how to move to another form from a form..ie.im in 'here.php' page..i want to go to the 'overhere.php'by using a BUTTON.. what code should i use?..can any1 give me a sample?..sry if i sound like a noob..coz i am really a noob..

Link to comment
Share on other sites

Use the <form> tag. The below code should do what you want.

<form action="overhere.php" method="post">  <div><input type="submit" value="Click Me!"></div></form>

Link to comment
Share on other sites

If you really want to use a <button>, you can just surround it with an <a>nchor tag, no <form> necessary:

<a href="overhere.php"><button>Click me!</button></a>

Link to comment
Share on other sites

I think what you might be looking for (aside from the form information) is that when one PHP page passes form information to another PHP page, the POST variables are available to the new page. You just have to write code in your PHP page to check if the incoming POST data is there and if its what you're expecting it to be. If all is good, then you can use it in the second page.edit: sorry, I realized he was just asking how to do it with a button.

Link to comment
Share on other sites

I'm not sure if this is what you're looking for, but here's an example of two forms where the second one displays the data from the first:

<form action="page2.php" method="post">Input 1:<input type="text" name="input1"><br>Input 2:<input type="text" name="input2"><br><input type="submit" value="Submit"></form>

<form method="post">Input 1:<input type="text" name="input1" value="<?php echo isset($_POST['input1']) ? $_POST['input1'] : ''; ?>"><br>Input 2:<input type="text" name="input2" value="<?php echo isset($_POST['input2']) ? $_POST['input2'] : ''; ?>"><br>Input 3:<input type="text" name="input3"><br>Input 4:<input type="text" name="input4"><br><input type="submit" value="Submit"></form>

If you didn't want to display the data on the second form you could use a hidden input there instead of a text input.

Link to comment
Share on other sites

I think what you might be looking for (aside from the form information) is that when one PHP page passes form information to another PHP page, the POST variables are available to the new page. You just have to write code in your PHP page to check if the incoming POST data is there and if its what you're expecting it to be. If all is good, then you can use it in the second page.edit: sorry, I realized he was just asking how to do it with a button.
YOUR RIGHT!!!
I'm not sure if this is what you're looking for, but here's an example of two forms where the second one displays the data from the first:
<form action="page2.php" method="post">Input 1:<input type="text" name="input1"><br>Input 2:<input type="text" name="input2"><br><input type="submit" value="Submit"></form>

<form method="post">Input 1:<input type="text" name="input1" value="<?php echo isset($_POST['input1']) ? $_POST['input1'] : ''; ?>"><br>Input 2:<input type="text" name="input2" value="<?php echo isset($_POST['input2']) ? $_POST['input2'] : ''; ?>"><br>Input 3:<input type="text" name="input3"><br>Input 4:<input type="text" name="input4"><br><input type="submit" value="Submit"></form>

If you didn't want to display the data on the second form you could use a hidden input there instead of a text input.

thx jsg.. SOLVE..
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...