How to get the Option Value?
| From: | Gu Weidong-a1923c | Date: | Sat, 28 Apr 2001 05:54:50 +0000 |
| Subject: | How to get the Option Value? | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-7110@lists.php.net to get a copy of this message | ||
I try to create the dynamic list and want to get the selected value. But every time I got the
'2001' whatever I selected from the list. Like to hear your advice.
Thanks,
Weidong
-------------------------------------------------------------------------------------------------------------------------
/*test_option.php*/
<?php
$today=getdate();
$year=$today[year];
?>
<html>
<body>
<form action="test_option.php" method="post">
Year<SELECT NAME="year">
<OPTION VALUE="" SELECTED>
<? for ($i=0; $i<= 10;$i++) { ?>
<OPTION VALUE=<?echo $year-$i;?>><?echo $year-$i;?>
<?}?>
</SELECT>
<input type="submit">
</form>
</body>
</html>
<?php
echo $year;
?>