arden Posted April 30, 2010 Share Posted April 30, 2010 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 More sharing options...
Err Posted April 30, 2010 Share Posted April 30, 2010 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 More sharing options...
Synook Posted April 30, 2010 Share Posted April 30, 2010 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 More sharing options...
thescientist Posted April 30, 2010 Share Posted April 30, 2010 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 More sharing options...
jeffman Posted April 30, 2010 Share Posted April 30, 2010 I think the question needs to be clarified. arden, are you confused about the button/link, or are you confused about moving data from 'here.php' to 'overhere.php' ? Link to comment Share on other sites More sharing options...
thescientist Posted April 30, 2010 Share Posted April 30, 2010 maybe its both...move from one form to another form with a button? Link to comment Share on other sites More sharing options...
justsomeguy Posted April 30, 2010 Share Posted April 30, 2010 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 More sharing options...
arden Posted May 1, 2010 Author Share Posted May 1, 2010 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.