Guest elthomo Posted February 28, 2008 Share Posted February 28, 2008 Ok what I want to do is navigate via the 5 radio buttons I created. <?PHP $hoeveel = 'unchecked'; $betalingsregaling = 'unchecked'; $afspraak = 'unchecked'; $doorgeven = 'unchecked'; $vraag = 'unchecked'; if (isset($_POST['Submit1'])) { $selected_radio = $_POST['infotype']; if ($selected_radio = 'hoeveel') { $hoeveel = 'checked'; } else if ($selected_radio = 'betalingsregaling') { $betalingsregaling = 'checked'; header("Location: page2.php"); } else if ($selected_radio = 'afspraak') { $afspraak = 'checked'; } else if ($selected_radio = 'doorgeven') { $doorgeven = 'checked'; } else if ($selected_radio = 'vraag') { $vraag = 'checked'; } } ?> The HTML FORM code: <FORM name ="form1" method ="post" action ="?"> <Input type = 'Radio' Name ='infotype' value= 'hoeveel' <?PHP print $hoeveel; ?> >Ik wil weten hoeveel ik nog dien te betalen. <br> <Input type = 'Radio' Name ='infotype' value= 'betalingsregaling' <?PHP print $betalingsregaling; ?> >Ik wil een betalingsregaling treffen. <br> <Input type = 'Radio' Name ='infotype' value= 'afspraak' <?PHP print $afspraak; ?> >Ik wil een afspraak maken <br> <Input type = 'Radio' Name ='infotype' value= 'doorgeven ' <?PHP print $doorgeven; ?> >Ik wil iets doorgeven. (bijvoorbeeld adreswijziging) <br> <Input type = 'Radio' Name ='infotype' value= 'vraag' <?PHP print $vraagl; ?> >Ik heb een vraag <P> <Input type = "Submit" Name = "Submit1" VALUE = "Welke informatie wil u hebben?"> </FORM> I have found this code which may possibly do what I want but I'm unsure where to put it within my code to make it work(assuming it will work with my code.) <?php if($_POST['selected_radio'] == "hoeveel') { header("Location: page2.php"); } elseif($_POST['selected_radio'] == 'betalingsregaling') { header("Location: page3.php"); } ?> Link to comment https://forums.phpfreaks.com/topic/93479-radio-button-navigation/ Share on other sites More sharing options...
aruns Posted February 28, 2008 Share Posted February 28, 2008 Try with functions Link to comment https://forums.phpfreaks.com/topic/93479-radio-button-navigation/#findComment-478934 Share on other sites More sharing options...
Lijoyx Posted February 28, 2008 Share Posted February 28, 2008 hey dude, you typed something like " if ($selected_radio = 'hoeveel') { $hoeveel = 'checked'; } " in ur code its actuly. you should use '==' sign insted of '='. and last portion of the code i mean method is ok. hope this is useful. Link to comment https://forums.phpfreaks.com/topic/93479-radio-button-navigation/#findComment-478952 Share on other sites More sharing options...
Guest elthomo Posted February 28, 2008 Share Posted February 28, 2008 hey dude, you typed something like " if ($selected_radio = 'hoeveel') { $hoeveel = 'checked'; } " in ur code its actuly. you should use '==' sign insted of '='. and last portion of the code i mean method is ok. hope this is useful. Thanks for that and it was useful. Here is the working code in case anyone wants to use it. <?PHP $hoeveel = 'unchecked'; $betalingsregaling = 'unchecked'; $afspraak = 'unchecked'; $doorgeven = 'unchecked'; $vraag = 'unchecked'; if (isset($_POST['Submit1'])) { $selected_radio = $_POST['infotype']; if ($selected_radio == 'hoeveel') { $hoeveel = 'checked'; header("Location: page1.php"); } else if ($selected_radio == 'betalingsregaling') { $betalingsregaling = 'checked'; header("Location: page2.php"); } else if ($selected_radio == 'afspraak') { $afspraak = 'checked'; header("Location: page3.php"); } else if ($selected_radio == 'doorgeven') { $doorgeven = 'checked'; header("Location: page6.php"); } else if ($selected_radio == 'vraag') { $vraag = 'checked'; header("Location: page5.php"); } } ?> The HTML FORM code: <FORM name ="form1" method ="post" action ="?"> <Input type = 'Radio' Name ='infotype' value= 'hoeveel' <?PHP print $hoeveel; ?> >Ik wil weten hoeveel ik nog dien te betalen. <br> <Input type = 'Radio' Name ='infotype' value= 'betalingsregaling' <?PHP print $betalingsregaling; ?> >Ik wil een betalingsregaling treffen. <br> <Input type = 'Radio' Name ='infotype' value= 'afspraak' <?PHP print $afspraak; ?> >Ik wil een afspraak maken <br> <Input type = 'Radio' Name ='infotype' value= 'doorgeven' <?PHP print $doorgeven; ?> >Ik wil iets doorgeven. (bijvoorbeeld adreswijziging) <br> <Input type = 'Radio' Name ='infotype' value= 'vraag' <?PHP print $vraag; ?> >Ik heb een vraag <P> <Input type = "Submit" Name = "Submit1" VALUE = "Welke informatie wil u hebben?"> </FORM> Solved(sorry still don't know where the button is mark it as such) Link to comment https://forums.phpfreaks.com/topic/93479-radio-button-navigation/#findComment-478978 Share on other sites More sharing options...
trq Posted February 28, 2008 Share Posted February 28, 2008 The solved button is out of action for the moment, were working on it. For now, if your thread is solved its probably best to simply leave it allone. replying with solved simply bumps it back to the top of the board. Link to comment https://forums.phpfreaks.com/topic/93479-radio-button-navigation/#findComment-478984 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.