Re: Dynamic Form List - how to change values

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tedd wrote:
I have a list from a MYSQL database that I am dumping to a screen. I'd like the user to be able to change the quantity on the form for any record on the screen, then post that information back so the user can review it, and I can then update the database.

Simple checkout routine. Or so I thought.

I have these fields displayed on the screen before the user changes the quantity:

$imageqty = $row["cialbum"]."-".$row["ciset"]."-".$row["ciimage"];
$qty = $row["ciqty"];
print "<td align='center' valign='top'><input type='text' name='$imageqty' size='5' value='$qty'></td>";

I've set the $imageqty variable to hold the initial value from the database. The initial screen works fine.

However, when I reprocess the file, how can I retrieve the original value of the field that is named the same as $imageqty?

The form outputs something like this:
http://.../chkout.php?NATURE-1.jpg=6&continue=Continue+Checkout, which does show the $imageqty of "NATURE-1.jpg" value with the new qty of "6".

How can I get the script to pull the value?

$imageqty = $row["cialbum"]."-".$row["ciset"]."-".$row["ciimage"];
$newqty = $_GET["$imageqty"];

Retrieves nothing.

Thanks for your help.

Pat

Pat:

I would suggest changing to:

http://.../chkout.php?imagename=NATURE-1.jpg&count=6&continue=Continue+Checkout,

$newqty = $_GET['count'];
$imagename = $_GET['imagename'];

Also, to see what you are actually "getting" try:

echo ("<br/>");
echo ("<pre>");
echo ("GET info:\n");
print_r($_GET);
echo("</pre>");

You might also want to consider taking care of undefined variables -- here's a reference:

http://www.weberdev.com/get_example-3823.html

HTH's

tedd


Ok, this works for one item, but my shopping cart may have (hopefully) dozens of items in it. How do I refer to each new quantity changes for each new row in the table? I was hoping that by making the qty field a name of the image, I would be able to match the new qty up with the right image quickly, but that won't work, obviously.

How can I change multiple items in a list (or all) when the list is dynamically created? My approach may be wrong -- suggestions?

Pat

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux