PDA

View Full Version : place loop inside a select form field?


jarv
06-27-2008, 03:40 PM
At the moment my code outputs many select boxes with all dates, I want one select box with all the dates, how can i do this?

$result3 = mysql_query("SELECT HeaderDate FROM Headertbl");


while($row2 = mysql_fetch_array($result3))
{
$HeaderDate = $row2['HeaderDate'];
echo '<h2><select name="$HeaderDate"><option value="'.$HeaderDate.'">'.$HeaderDate.'</option></select></h2>';
}

abduraooft
06-27-2008, 03:46 PM
put your select tag outside the loop
<select......>
<?php
while(){
echo "<option.........>";
}
?>
</select>