Jump to content

Multiple inserts, drop down menu not showing for each row


Eiolon

Recommended Posts

I am working on a script to insert multiple rows into a table.  The the front end, I have a drop down menu called "CODE".  It shows for the first row but not for the other rows:

 

Screenshot: http://www.intravising.com/code.jpg

 

How do I make it so the CODE is displayed for each row?

 

Thanks!

 

Here is my PHP/HTML:

 

$query_codes = "SELECT id, code FROM codes ORDER BY code ASC";
$codes = mysql_query($query_codes) OR die ('Cannot retrieve a list of codes.');

<table border="0" cellpadding="2" cellspacing="2" width="100%">
  <tr>
    <th width="50">CODE</th>
<th width="100">CALL NUMBER</th>
<th>DESCRIPTION</th>
<th width="75">ACQUIRED</th>
  </tr>
  <tr>
    <td width="50"><div align="center"><select name="code_id[]"><?php while($row_codes = mysql_fetch_array($codes)) { print '<option value="' . $row_codes['id'] . '">' . $row_codes['code'] . '</option>';}?></select></div></td>
<td width="100"><div align="center"><input name="call_number[]" type="text" style="width:100px" maxlength="50" /></div></td>
<td><div align="center"><input name="description[]" type="text" style="width:500px" /></div></td>
<td width="75"><div align="center"><input name="acquired[]" type="text" style="width:100px" maxlength="10" /></div></td>
</tr>
  <tr>
    <td width="50"><div align="center"><select name="code_id[]"><?php while($row_codes = mysql_fetch_array($codes)) { print '<option value="' . $row_codes['id'] . '">' . $row_codes['code'] . '</option>';}?></select></div></td>
<td width="100"><div align="center"><input name="call_number[]" type="text" style="width:100px" maxlength="50" /></div></td>
<td><div align="center"><input name="description[]" type="text" style="width:500px" /></div></td>
<td width="75"><div align="center"><input name="acquired[]" type="text" style="width:100px" maxlength="10" /></div></td>
</tr>
  <tr>
    <td width="50"><div align="center"><select name="code_id[]"><?php while($row_codes = mysql_fetch_array($codes)) { print '<option value="' . $row_codes['id'] . '">' . $row_codes['code'] . '</option>';}?></select></div></td>
<td width="100"><div align="center"><input name="call_number[]" type="text" style="width:100px" maxlength="50" /></div></td>
<td><div align="center"><input name="description[]" type="text" style="width:500px" /></div></td>
<td width="75"><div align="center"><input name="acquired[]" type="text" style="width:100px" maxlength="10" /></div></td>
</tr>
  <tr>
    <td width="50"><div align="center"><select name="code_id[]"><?php while($row_codes = mysql_fetch_array($codes)) { print '<option value="' . $row_codes['id'] . '">' . $row_codes['code'] . '</option>';}?></select></div></td>
<td width="100"><div align="center"><input name="call_number[]" type="text" style="width:100px" maxlength="50" /></div></td>
<td><div align="center"><input name="description[]" type="text" style="width:500px" /></div></td>
<td width="75"><div align="center"><input name="acquired[]" type="text" style="width:100px" maxlength="10" /></div></td>
</tr>
  <tr>
    <td width="50"><div align="center"><select name="code_id[]"><?php while($row_codes = mysql_fetch_array($codes)) { print '<option value="' . $row_codes['id'] . '">' . $row_codes['code'] . '</option>';}?></select></div></td>
<td width="100"><div align="center"><input name="call_number[]" type="text" style="width:100px" maxlength="50" /></div></td>
<td><div align="center"><input name="description[]" type="text" style="width:500px" /></div></td>
<td width="75"><div align="center"><input name="acquired[]" type="text" style="width:100px" maxlength="10" /></div></td>
</tr>
</table>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.