SocomNegotiator Posted November 3, 2008 Share Posted November 3, 2008 Ok what I am trying to do is take the items that are generated from the query below and upon submit add them to my order table in the DB. This sounds easy, but if you look at my code you will notice that before they submit an order they can re-enter in an amount next to their item. Well I need to keep track of each amount entered for each item. I am thinking I will have to use an array, but I am not sure of how to even set it up. As of right now I have it so that if an amount is changed they have to update each item individually before they can hit the final submit button. However, I know there is a way to make it so that all they have to do is enter in an amount next to each item and then hit submit. I also need this for the priority, but once I figure out how to do the amount I will be able to do the priority. <?php $user_id = $user->inf['id']; $db->query('SELECT item.id, item.name, guide_order.id, guide_order.amount, guide_order.priority, guide_order.user_id FROM guide_order LEFT JOIN item ON guide_order.item_id = item.id WHERE guide_order.user_id='.$user_id.' ORDER BY guide_order.priority ASC') or die(mysql_error()); $count = $db->num_rows(); if ($count == 0) { echo "<br /><div id='case'><p align='center' style='color: red;'>You have no items for this order to view.</p></div>"; } if ($count != 0) { ?> <style type="text/css"> .menu22 ul{ margin: 0px; padding: 0px; float: left;} .menu22 ul li{ display: inline; margin:2px 5px 5px 20px;} </style> <div class="menu22" align="center"> <table cellpadding='2' cellspacing='2' align='center'> <tr> <td align='center' style='border-bottom: 1px solid #FFFFFF; padding-right: 20px;'>Quantity</td> <td align='center' style='border-bottom: 1px solid #FFFFFF; padding-right: 20px;'>Item</td> <td align='center' style='border-bottom: 1px solid #FFFFFF; padding-right: 20px;'>Priority</td> <td align='center' style='border-bottom: 1px solid #FFFFFF; padding-right: 20px;'>Delete</td> </tr> <?php while($row = $db->fetch_array()) { ?> <form id='order_form1' action='' method='post'> <input type='hidden' name='pre_id' value='<?=$row['id']?>'/> <tr> <td align='center'><input type='text' name='amount' size='5' value='<?=$row['amount']?>' /></td> <td align='center'><?=$row['name']?></td> <td align='center'><input type='text' name='priority' size='5' value='<?=$row['priority']?>' /></td> <td align='center'><input type='submit' name='submit_delete' value='Delete' style="font-size:9px;"/></td> </tr> </form> <?php } ?><br /> </table> <form id='order_form' action='' method='post'> <input type='hidden' name='user_id' value='<?=$user_id?>'/><br /> Delivery Date: <input type="text" name="deliver" size="20" /><br /><br /> <input type='submit' name='submit' value='Submit Order'/> </form> </div> <?php } ?> Quote Link to comment https://forums.phpfreaks.com/topic/131217-php-multiple-updates-on-submit/ Share on other sites More sharing options...
SocomNegotiator Posted November 3, 2008 Author Share Posted November 3, 2008 Any ideas...? I think it would be similar to having a multiple delete, but with this it's an update to the database. Granted it will have more things that need to be put into the database. Quote Link to comment https://forums.phpfreaks.com/topic/131217-php-multiple-updates-on-submit/#findComment-681503 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.