jarv Posted June 27, 2008 Share Posted June 27, 2008 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>'; } Link to comment https://forums.phpfreaks.com/topic/112208-solved-place-loop-inside-a-select-form-field/ Share on other sites More sharing options...
xyn Posted June 27, 2008 Share Posted June 27, 2008 I think you mean this: $result3 = mysql_query("SELECT HeaderDate FROM Headertbl"); print '<h2><select name="$HeaderDate">'; while($row2 = mysql_fetch_array($result3)) { echo "<ption value=\"{$row2['HeaderDate']}\">{$row2['HeaderDate']}</option>'; } print '</select>'; Link to comment https://forums.phpfreaks.com/topic/112208-solved-place-loop-inside-a-select-form-field/#findComment-576002 Share on other sites More sharing options...
jarv Posted June 27, 2008 Author Share Posted June 27, 2008 thanks you very much Link to comment https://forums.phpfreaks.com/topic/112208-solved-place-loop-inside-a-select-form-field/#findComment-576035 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.