Jump to content

[SOLVED] Working with Drop Down Menu Values- Scarce Resources on this?


Modernvox

Recommended Posts

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>

 


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.

<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>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.