rewrite your <FORM> tags to have a name and a onSubmit() handler like: <FORM NAME="f1" METHOD=... ACTION=.... onSubmit()="return formSubmitted(this);"> Now inside each of your forms, have a hidden field named form_name like <input type=hidden name=form_name> Now put the following code within the <head></head> part on your page <script language="javaScript" type="text/javascript> function formSubmitted(theForm) { theForm.form_name = theForm.name; return(true); } </script> Now in your php script look for $_POST["form_name"] and depending on its value run your sql queries. HTH R'twick ----- Original Message ----- From: "Michael Knauf/Niles" <mknauf@nilesaudio.com> To: <php-db@lists.php.net> Sent: Monday, December 09, 2002 2:58 PM Subject: How do I... (update one table from one page which displays multiple editable tables)? > I have a simple form that displays the values of some fields in a table so > the user can edit those values and update the database. (mySql) the form > action is $php_self, and it triggers an update query that I haven't written > yet, because on the way there, I hit a small snag that I hope you can help > me with. > > You see, I want to put 8 r 9 forms on the same page, each with the ability > to update one table within the database... but how can I tell which form > the user wants to change? > > If my head was screwed on straight about this, that question might be more > comprehensible, but here's the code for the form, in case that clarifies > anything... > > <? > $id ="445"; //fixed value for testing > $productsQuery ="SELECT id, fgNumber, productName, productDescription FROM > products where id =$id"; > $productsRecordset = mysql_query($productsQuery) or die(mysql_error()); > $productsRow=mysql_fetch_array($productsRecordset); > ?> > <form name="products" method="post" action="$php_self"> > <table width="100%" border="0" cellpadding="10" cellspacing="0" bgcolor=" > #CCCCCC"> > <tr> > <td colspan="4">Products Table</td> > </tr> > <tr> > <td>ID: > <input name="productId" type="text" id="productId" > value="<? echo $productsRow['id'] ?>" size="5"></td> > <td>FG#: > <input name="fgNumber" type="text" id > ="fgNumber" value="<? echo $productsRow['fgNumber'] ?>" size="10"></td> > <td>Name: > <input name="productName" type="text" > id="productName" value="<? echo $productsRow['productName'] ?>" size > ="36"></td> > <td>Description > <input name="productDescriptiion" type > ="text" id="productDescriptiion" value="<? echo $productsRow > ['productDescription'] ?>" size="48"></td> > </tr> > <tr> > <td colspan="4">Update Product Information > <input type="submit" name="Submit" value > ="Submit"></td> > </tr> > </table> > > Michael > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php