Click to See Complete Forum and Search --> : value from drop down menu


legolaz
02-18-2003, 01:40 AM
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?

jpmoriarty
02-18-2003, 04:00 AM
in your asp or php script that's being called from the form you reference it's name.

so you'd have an HTML form along the lines of:

<form action="form.php" method="post">
<select name="month">
<option value="01">January</option>
<option value="02">February</option>
</select>
<input type="submit" value="send it">
</form>

and then you'd have the file "form.php":


<?php
if($_POST["month"]=="01")
$monthname = "January";
elseif($_POST["month"]=="02")
$monthname = "February"; etc etc
echo "You have selected ".$monthname;
?>


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.