Eiolon Posted March 11, 2010 Share Posted March 11, 2010 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> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.