I have a situation where the user of my page is supposed to select which licences they hold from a series of checkboxes. upon submitting, they are presented with their choices and asked to select the year and school for each degree. I have no problem getting the selected degrees to display with select boxes beside them, but the select box only contains the last item of the table it is supposed to be displaying. Here's the code. Any ideas? Thanks!
<td colspan="10" valign="top" align="center"><p>For each License, please select
the year of licensing</p></td>
</tr>
<tr>
<?php
if ($lcnse == "") $lcnse = array();
//HOW CAN I GET ALL OF THIS QUERY TO
//APPEAR IN THE SELECT BOX???
$yyyy = mysql_query("select ID, Year from YearDL order by Year asc");
while ($ann = mysql_fetch_array($yyyy)) {
$yid = $ann["ID"];
$yr = $ann["Year"];
}
foreach($lcnse as $licID) {
$license = mysql_query("select Name from License where ID=$licID");
while ($lic = mysql_fetch_array($license)) {
$ltype = $lic["Name"];
echo("<td valign='top' align='center'><fieldset><legend>$ltype</legend>
<select name='year' size='1'><option selected value=''>year awarded</option>
<option value='$yid'>$yr</option></fieldset></td>");
}
} ?>
I'm no expert, but I *THINK* that you are stating the html <OPTION> and <SELECT> tags for EVERY item in the resultset. Try this...
<td colspan="10" valign="top" align="center"><p>For each License, please select
the year of licensing</p></td>
</tr>
<tr>
<td valign='top' align='center'>
<?php
if ($lcnse == "") $lcnse = array();
$yyyy = mysql_query("select ID, Year from YearDL order by Year asc");
while ($ann = mysql_fetch_array($yyyy)) {
$yid = $ann["ID"];
$yr = $ann["Year"];
}
foreach($lcnse as $licID) {
$license = mysql_query("select Name from License where ID=$licID");
while ($lic = mysql_fetch_array($license)) {
$ltype = $lic["Name"];
Bookmarks