SitePoint Sponsor |
|
User Tag List
Results 1 to 1 of 1
Hybrid View
-
May 6, 2004, 11:27 #1
Changing multiple fields from one form
I am not sure if this is possible or if I am looking at it from the right direction any help or input is appreciated.
I have 2 tables.
menu
--------
id
name
description
price
cat_id
active_id
order_menu
------------
order_id
menu_id
cat_id
What I am trying to do is sort the items from the menu table based on an order in the order_menu table. That works fine. The only problem is if I want to change the order i can't seem to do it simply.
I am currently building a dynamic html table from a mysql array.
Code://query to get menu items only from the appropriate category //as there are lots of items in the whole database //we only want to display items from selected category $menudisplaysql="SELECT * FROM menu where cat='$loadcatdrop'"; $menudisplayresult=mysql_query($menudisplaysql); while($menudisplaydata=mysql_fetch_array($menudisplayresult)){ $displayid=$menudisplaydata['id']; $displayname=$menudisplaydata['name']; $displaydescription=$menudisplaydata['description']; $displayprice=$menudisplaydata['price']; $displaycat=$menudisplaydata['cat']; //order_menu query to order items $ordersql="SELECT * from order_menu ORDER BY order_id"; $orderresult=mysql_query($ordersql); while($orderdata=mysql_fetch_array($orderresult)){ $menuid=$orderdata['menu_id']; $orderdisplay=$orderdata['order_id']; $ordercatid=$orderdata['cat_id']; //takes selected items frm above and displays them //because menu_id is the id from the menu table if($displayid == $menuid){ //table to display items from array echo '<tr> <td><b>'.$displayname.'</b></td> <td><b>'.$displayprice.'</b></td> </tr> <tr> <td colspan="2"><b>'.$displaydescription.'</b></td> //here is the input box for the order from the order_menu table //i want to be able to switch these numbers and hit the update order //button to be able to update all the order_id values <td><input type="text" name="orderdisplaynew" value="'.$orderdisplay.'"></input></td> </tr><tr>'; }}} echo '</table>';} echo '<input type="submit" name="orderupdate" value="Update Order"></input>';
Any ideas?
rodin
Bookmarks