DataSpy Posted October 9, 2006 Share Posted October 9, 2006 I'm using a for loop to create a specific number of containers, lets say 3, and each container has a different number. I want to create an entry in the database for each contain but I've never done this before and has no idea about how to go about doing it. Here some code in case it's hard to understand[code]<tr> <td> Company </td> <td> <input type="text" name="company" size="18"> </td> </tr> <tr> <td> Booking Number </td> <td> <input type="text" name="booking_num" size="18"> </td> </tr> <?php $number_of_containers=$HTTP_POST_VARS['number_of_containers']; for($i=0; $i < $number_of_containers; $i++){ echo " <tr> <td> Container " .($i+1). " </td> <td> <input type='text' name='containers[$i]' value='Container #' size='18'> </td> </tr>";} ?> <tr>[/code]Then for each container # i want an entry in the database with the same company and booking#, but the container #'s will all be different. I know how to enter stuff into a database, I just need help with this array. Any help greatly appretiated, thanx in advance!!! Link to comment https://forums.phpfreaks.com/topic/23395-help-with-inserting-an-array-into-database/ Share on other sites More sharing options...
fenway Posted October 9, 2006 Share Posted October 9, 2006 I'm not sure I understand what you need help with... the PHP logic, or the actual DB statement. Link to comment https://forums.phpfreaks.com/topic/23395-help-with-inserting-an-array-into-database/#findComment-106112 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.