Modernvox Posted November 17, 2009 Share Posted November 17, 2009 Been looking around for the past 2 hours for a tutorial on working with drop down values. I have the following form and attempting to work with it's values. I guess I simply need to know the proper syntax to call one or however many of these values? If there is a good tutorial I would appreciate just as much? <form action="getquote.php" method= "post"> Number of rooms: <input type= "text" name= "rooms" size= "1"/></br> Sq. ft for room 1 <select name="room1"> <option value="192">8x8</option> <option value="240">8x10</option> <option value="360">10x12</option> <option value="432">12x12</option> <option value="540">12x15</option> <option value="765">15x17</option> <option value="1224">17x24</option> </select></br> <input type="submit" name="submit" /> </form> Quote Link to comment https://forums.phpfreaks.com/topic/181820-solved-working-with-drop-down-menu-values-scarce-resources-on-this/ Share on other sites More sharing options...
mikesta707 Posted November 17, 2009 Share Posted November 17, 2009 I'm kind of confused on what you want. if you want the value of the drop down box selection, just do $dropDown = $_POST['room1'];//room1 is the name of the select group Quote Link to comment https://forums.phpfreaks.com/topic/181820-solved-working-with-drop-down-menu-values-scarce-resources-on-this/#findComment-958876 Share on other sites More sharing options...
Modernvox Posted November 17, 2009 Author Share Posted November 17, 2009 I'm kind of confused on what you want. if you want the value of the drop down box selection, just do $dropDown = $_POST['room1'];//room1 is the name of the select group I actually want the values "192", "240" etc. based on the users selection so I may add them together down the road. Quote Link to comment https://forums.phpfreaks.com/topic/181820-solved-working-with-drop-down-menu-values-scarce-resources-on-this/#findComment-958879 Share on other sites More sharing options...
Modernvox Posted November 17, 2009 Author Share Posted November 17, 2009 I am attempting to get to the numeric values of each selection, how do I do this? Quote Link to comment https://forums.phpfreaks.com/topic/181820-solved-working-with-drop-down-menu-values-scarce-resources-on-this/#findComment-958895 Share on other sites More sharing options...
Modernvox Posted November 17, 2009 Author Share Posted November 17, 2009 Also I am using 5 drop down menus. Quote Link to comment https://forums.phpfreaks.com/topic/181820-solved-working-with-drop-down-menu-values-scarce-resources-on-this/#findComment-958897 Share on other sites More sharing options...
Modernvox Posted November 17, 2009 Author Share Posted November 17, 2009 <form action="getquote.php" method= "post"> Number of rooms: <input type= "text" name= "rooms" size= "1"/></br> <select name="room1"> <option value="---------">-----</option> <option value="192">8x8</option> <option value="240">8x10</option> <option value="360">10x12</option> <option value="432">12x12</option> <option value="540">12x15</option> <option value="765">15x17</option> <option value="1224">17x24</option> </select></br></br> And here's my shortened php code <html> <body> <?php if(isset($_POST['submit'])) if ( $_POST['rooms'] == "192") { echo "great!"; } ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/181820-solved-working-with-drop-down-menu-values-scarce-resources-on-this/#findComment-958898 Share on other sites More sharing options...
mikesta707 Posted November 17, 2009 Share Posted November 17, 2009 its $_POST['room1'] not $_POST['rooms1'] Quote Link to comment https://forums.phpfreaks.com/topic/181820-solved-working-with-drop-down-menu-values-scarce-resources-on-this/#findComment-958900 Share on other sites More sharing options...
Modernvox Posted November 17, 2009 Author Share Posted November 17, 2009 its $_POST['room1'] not $_POST['rooms1'] I understand Mike, but it still doesn't display anything? All I am trying to do is grab the value I predefined for that selection? Quote Link to comment https://forums.phpfreaks.com/topic/181820-solved-working-with-drop-down-menu-values-scarce-resources-on-this/#findComment-958902 Share on other sites More sharing options...
Modernvox Posted November 17, 2009 Author Share Posted November 17, 2009 Nothing being displayed... <html> <body> <?php if(isset($_POST['submit'])) $_POST['room1'] = $dimen1; if ($dimen1 == "8x8") { echo "gr8"; } ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/181820-solved-working-with-drop-down-menu-values-scarce-resources-on-this/#findComment-958905 Share on other sites More sharing options...
Modernvox Posted November 17, 2009 Author Share Posted November 17, 2009 I managed to get the value from the fifth array in my drop doen menu, but how do i get the rest? Quote Link to comment https://forums.phpfreaks.com/topic/181820-solved-working-with-drop-down-menu-values-scarce-resources-on-this/#findComment-958906 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.