Re: Re: Using one submit button

From: Date: Wed, 17 Apr 2002 17:02:44 +0000
Subject: Re: Re: Using one submit button
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-93352@lists.php.net to get a copy of this message
On Thursday 18 April 2002 00:11, Jennifer Downey wrote: > I have no takers on this one? > > Just to let you know I have been working on this to here is some new code. > What I need this to do is update the price in the db table. > if I have on item it is fine. If I have two items it won't update the > first items price but will the second. if I try to enter a price in the > first items textbox it doesn't update and then deletes the second item's > price. > > If I have 15 items and using one submit button how do I get this to update > all items that are listed? > > $query = "SELECT uid, id, name, image, type, quantity, price FROM > {$config["prefix"]}_shop WHERE uid = {$session["uid"]}"; > $ret = mysql_query($query); > while($row = mysql_fetch_array($ret)) > { > $uid = $row['uid']; > $id = $row['id']; > $name = $row['name']; > $image = $row['image']; > $iquantity = $row['quantity']; > $itype = $row['type']; > $iprice = $row['price']; > > if($update) > { > $eprice = '$price[]'; I don't know what else is wrong with your code, but this is *definitely* going to cause problems. I assume you mean: $eprice = $price[]; But even this is wrong. You should probably be keeping a counter, eg $i, then use: $eprice = $price[$i]; [snip] > value=\"\" name=\"price[]\" size='8' value=\"\" name=\"price[$i]\" size='8' -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* We have a equal opportunity Calculus class -- it's fully integrated. */

« previous php.general (#93352) next »