Jump to content

[SOLVED] drop down boxes


joebudden

Recommended Posts

Hi guys, i just want to know if this is possible, or if any one has a simple solution.....

 

ok, iv got a form with a drop down box which has three values

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<select>
  <option>Heavy training with emphasis on strength and stamina</option>
  <option>Medium training with emphasis on fast paced attacking football</option>
  <option>Light training focused on quick passing and set piece play</option>
</select>
<input type="submit" value="Begin Training Session" />
</form>

 

Say the user selects "Heavy training with emphasis on strength and stamina".....

is there any way of inserting a "1" into a database table and so on for the others???

 

Anyone know if its possible ???

 

thanks in advance

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/36764-solved-drop-down-boxes/
Share on other sites

hmmmm so I have

 

<select>

  <option value="1">Heavy training with emphasis on strength and stamina</option>

  <option value="2">Medium training with emphasis on fast paced attacking football</option>

  <option value="3">Light training focused on quick passing and set piece play</option>

</select>

 

but then how would I implement if(isset statements to insert the values into my DB???

 

Il have a look on the net but if anyone knows please reply!!!

 

cheers

<?php 
if(isset($_POST['submit'])){
$type = $_POST['type'];

//...mysql insert or whatever you want...
}
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<select name="type">
 <option>Heavy training with emphasis on strength and stamina</option>
 <option>Medium training with emphasis on fast paced attacking football</option>
 <option>Light training focused on quick passing and set piece play</option>
</select>
<input type="submit" name="submit" value="Begin Training Session" />
</form>

I think thats basically it.

Ted

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.