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>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.