
Originally Posted by
TwitterRooms
why does this code output 127 no matter what year is selected
PHP Code:
echo '<select name="yearbirth">';
$year_from = date("Y",time()) - 8;
$year_to = date("Y",time()) - 100;
if ($_REQUEST['yearbirth'])
$yearkey = $_REQUEST['yearbirth'];
else
$yearkey = $year_from - 12;
for ($i=$year_from;$i>$year_to;$i--) {
$selected = '';
if ($yearkey == $i)
$selected = 'selected';
echo '<option value="'.$i.'" '.$selected.'>'.$i.'</option>';
}
echo '</select>';
Your question is unclear.
Please provide more information, and be as specific as possible.
- What do you want to accomplish?
- What have you already tried?
- What problems did you encounter?
Also, please be sure that you have included all relevant code and/or a link to the page in question.
1. What do you mean, "output 127 no matter what"? It should be outputting a lot of stuff, starting with <select name="yearbirth">.
2. What is the value of $_REQUEST['yearbirth']?
Bookmarks