ma5ect Posted October 16, 2008 Share Posted October 16, 2008 hi all, i have a form with few options. what i am trying to do is display the option chosen from the user onto another page..i have the form setup up but what do i code to display the chosen option on the second page?? Quote Link to comment https://forums.phpfreaks.com/topic/128750-solved-display-chosen-option-onto-another-webpage/ Share on other sites More sharing options...
waynew Posted October 16, 2008 Share Posted October 16, 2008 $_POST['name-of-form-object'] Post your form please. Quote Link to comment https://forums.phpfreaks.com/topic/128750-solved-display-chosen-option-onto-another-webpage/#findComment-667291 Share on other sites More sharing options...
ma5ect Posted October 16, 2008 Author Share Posted October 16, 2008 <form id="form1" name="form1" method="post" action=""> <div align="center"><img src="mm_spacer.gif" alt="" width="35" height="1" border="0" /> <table width="200"> <tr> <td><label> <input type="radio" name="RadioGroup1" value="radio" id="RadioGroup1_0" /> Enterprise System</label></td> </tr> <tr> <td><label> <input type="radio" name="RadioGroup1" value="radio" id="RadioGroup1_1" /> Unix </label></td> </tr> <tr> <td><label> <input type="radio" name="RadioGroup1" value="radio" id="RadioGroup1_2" /> Service management </label></td> </tr> <tr> <td><label> <input type="radio" name="RadioGroup1" value="radio" id="RadioGroup1_3" /> Network admin </label></td> </tr> </table> </div> </form> Quote Link to comment https://forums.phpfreaks.com/topic/128750-solved-display-chosen-option-onto-another-webpage/#findComment-667296 Share on other sites More sharing options...
Maq Posted October 16, 2008 Share Posted October 16, 2008 </pre> <form id="form1" name="form1" method="post" action="">< First, you have to include the page you're passing it to: </pre> <form id="form1" name="form1" method="post" action="your_page.php">< Quote Link to comment https://forums.phpfreaks.com/topic/128750-solved-display-chosen-option-onto-another-webpage/#findComment-667299 Share on other sites More sharing options...
Andy-H Posted October 16, 2008 Share Posted October 16, 2008 thisPage.html <form method="post" action="nextPage.php"> <input type="text" name="txtInput" size="20" /><br /> <input type="submit" name="btnSubmit" value="Submit Data" /> </form> nextPage.php <?php if ( isset($_POST['btnSubmit']) ){ if ( !empty($_POST['txtInput']) ){ $strInfo = $_POST['txtInput']; }else{ $strInfo = "You didn't submit any data in the form field."; } echo htmlentities($strInfo, ENT_QUOTES); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/128750-solved-display-chosen-option-onto-another-webpage/#findComment-667302 Share on other sites More sharing options...
ma5ect Posted October 16, 2008 Author Share Posted October 16, 2008 what code goes onto the second page...to display the chosen option Quote Link to comment https://forums.phpfreaks.com/topic/128750-solved-display-chosen-option-onto-another-webpage/#findComment-667317 Share on other sites More sharing options...
Maq Posted October 16, 2008 Share Posted October 16, 2008 $_POST['RadioGroup1']; Quote Link to comment https://forums.phpfreaks.com/topic/128750-solved-display-chosen-option-onto-another-webpage/#findComment-667329 Share on other sites More sharing options...
ma5ect Posted October 16, 2008 Author Share Posted October 16, 2008 this is the 1st page..this works <form method="post" action="nextPage.php"> <p align="center"> <input type="text" name="txtInput" size="20" /> <input type="submit" name="btnSubmit" value="Submit Data" /> </p> <p align="center"> </p> <div align="center"> <table width="200"> <tr> <td><label> <div align="center"> <input type="radio" name="RadioGroup1" value="radio" id="RadioGroup1_0" /> Radio</div> </label></td> </tr> <tr> <td><label> <div align="center"> <input type="radio" name="RadioGroup1" value="radio" id="RadioGroup1_1" /> Radio</div> </label></td> </tr> <tr> <td><label> <div align="center"> <input type="radio" name="RadioGroup1" value="radio" id="RadioGroup1_2" /> Radio</div> </label></td> </tr> <tr> <td><label> <div align="center"> <input type="radio" name="RadioGroup1" value="radio" id="RadioGroup1_3" /> Radio</div> </label></td> </tr> </table> </div> <p align="center"><br /> </p> </form> 2nd page...cant get the options to display <?php if ( isset($_POST['btnSubmit']) ){ if ( !empty($_POST['txtInput']) ){ $strInfo = $_POST['txtInput']; }else{ $strInfo = "You didn't submit any data in the form field."; $_POST['RadioGroup1_0']; $_POST['RadioGroup2_1']; $_POST['RadioGroup3_2']; $_POST['RadioGroup4_3']; } echo htmlentities($strInfo, ENT_QUOTES); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/128750-solved-display-chosen-option-onto-another-webpage/#findComment-667355 Share on other sites More sharing options...
prexep Posted October 16, 2008 Share Posted October 16, 2008 You can't pass the ID as the name. $_POST['FormName'] = Value. Quote Link to comment https://forums.phpfreaks.com/topic/128750-solved-display-chosen-option-onto-another-webpage/#findComment-667392 Share on other sites More sharing options...
Maq Posted October 17, 2008 Share Posted October 17, 2008 It's a radio group, there's only 1 value because you can only choose 1 out of the group. You have to use the name. Quote Link to comment https://forums.phpfreaks.com/topic/128750-solved-display-chosen-option-onto-another-webpage/#findComment-667724 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.