Need help redirecting radio buttons and forum submit buttons Hey guys. So im extremely excited to now be apart of this community. Im fairly new to php, I have been coding with it for about 5 months and I quickly realized that If I was going to be any good at this that I would need to get plugged into a community. So I here to learn and contribute. Ok so I have been working with a small project for a few weeks now and I have a few questions that I need some help on. First off I would like to show you my diagram and then explain what im trying to accomplish. Im not asking for you the full blown code, I just need some answers to some very specific questions, I just thought I would post my diagram so you would have a good idea of what im trying to do so that you can accurately answer my question. Ok, so what I have done is built 4 radio choices in the index.php page along with a submit button, and what im trying to do is when a person chooses item_1 it takes them to a different page when they hit submit. Then what happens is say that when they chose item_1 it takes them to item_1.php, and inside item_1.php they will need to fill out some very basic information and hit submit. When they hit submit, the information needs to print on the final page, but the user needs to be taken to the next page for more information, and so on till they reach the final page. I would also like to add that im using a basic html form for the information to be added into.. My first question is how do I get my radio boxes to redirect to a page based on the answer given. So when I chose item_1 it goes to item_1.php and item_2 goes to item_2.php and so on.. my second question is, when I submit the information I filled out, how do I get the information to print on the final page, but then send the user to the next page for more information.. Like I said, im not asking you to do it all for me, Im just looking for a bit guidance from you guys. Thanks guys for all your help!
You can use header() to redirect the user: header('Location: http://google.com'); but I don't see why you wouldn't just show the user a different form according to which radio button they chose.
We do want to show them a different form different form according to which radio button they chose.. That is exactly what we want to do.. Its like i was showing you in the diagram. depending on which radio button they chose it will take them down a different road with different questions on different pages.
ok, so i think i miss worded myself so im just going to show you my basic index form code with some comments. <html> <head> <title> forms </title> </head> <body> <form action="final.php" Method="post"><br /> <input type="radio" name="1" value="1" />Item 1<br /> //After submitted item goes to item_1.php <input type="radio" name="2" value="2" /> Item 2<br />//After submitted item goes to item_2.php <input type="radio" name="3" value="3" /> Item 3<br />//After submitted item goes to item_3.php <input type="radio" name="4" value="4" /> Item 4<br />//After submitted item goes to item_4.php <input type="submit" value="Go" /> </form><br /> </body> </html> Code (markup): Im not talking about redirecting the whole page, im just talking about sending them to a different page depending on which item they chose. Sorry if i miss worded myself or did not explain my question better.. thanks guys for all our help.
Name all the radio buttons the same eg. next_form. <?php $nextForm = $_POST['nextForm']; If($nextForm==1){ header('Location: item_1.php'); } else if($nextForm==2){ header('Location: item_.php'); } else if($nextForm==3){ header('Location: item_3.php'); } else if($nextForm==4){ header('Location: item_4.php'); } else{ echo 'error'; } ?> PHP: