value from drop down menu

liunx

Guest
i have a drop down menu which allows a user to select year. month and day. the question is how do i get the value of the year or month etc the user selected?<!--content-->in your asp or php script that's being called from the form you reference it's name.<br />
<br />
so you'd have an HTML form along the lines of:<br />
<br />
<form action="form.php" method="post"><br />
<select name="month"><br />
<option value="01">January</option><br />
<option value="02">February</option><br />
</select><br />
<input type="submit" value="send it"><br />
</form><br />
<br />
and then you'd have the file "form.php":<br />
<br />
<br />
<?php<br />
if($_POST["month"]=="01")<br />
$monthname = "January";<br />
elseif($_POST["month"]=="02")<br />
$monthname = "February"; etc etc <br />
echo "You have selected ".$monthname;<br />
?><br />
<br />
<br />
It's pretty easy to do with asp too, but i'm a php junkie personally. But you will need (as far as im aware, my java's pretty shoddy so am unaware of its capabilities) a server-side scripting language. It's not something that can be done client side.<!--content-->
 
Back
Top