Re: Dynamic Form List - how to change values

From: Date: Thu, 02 Mar 2006 01:45:10 +0000
Subject: Re: Dynamic Form List - how to change values
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-231308@lists.php.net to get a copy of this message
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: You can add numerous items to the url. I don't remember the total number of characters that's allowed, but it's considerable. If you reach the limit, but might consider reducing the number of characters in your variables, such as: "NATURE-1.jpg" could be n1 where you had a look-up table or you knew what the cryptic code was to make the transformation. Or you could continue on a course like you were with n1=6 where you know that n1 stands for "NATURE-1.jpg" and the value contained therein is the value for that image. There's lot's of ways to do this. As for it being dynamically created, that shouldn't present a problem either -- just treat the url as a string and add ampersands (&) between "variables and their value" pairs. HTH's tedd -- -------------------------------------------------------------------------------- http://sperling.com

« previous php.general (#231308) next »