Re: [PHP] About MYSQL/PHP Shopping Cart's Product Quantity Change Input Forms
At 4:00 PM -0700 9/14/07, Ji H. Park wrote: *The question: How would you have multiple text input forms (on shopping cart page) with different inputted data (product quantities) submitted for querying the database (for changing the quantity of multiple products in the shopping cart at the same time)?*** *Here is an ideal example to clarify the matter:* When a customer wants to change quantities of multiple products all at once in the shopping cart, all the quantities has to be changed at the same time just by clicking a button called (e.g. Update Quantity). *Issue*: Currently I have update quantity buttons for each product, which isn't convenient. I would appreciate any tips, techniques, comments, or reference to any website regarding this issue at your repository, thanks! In addition to what others have said, use javascript to adjust quantities and cost until the user wants to submit like so: http://webbytedd.com/c/form-calc/ There's little reason to make the user click Update Quantity repeatedly before the user is finished with his/her order IF you are offering several items -- like found in a shopping cart. After the user clicks submit, then use php to make sure the data is what you expect. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] About MYSQL/PHP Shopping Cart's Product Quantity Change Input Forms
Name all your input boxes the same thing, and include a similar level hidden input: input type=hidden name=sku[] value=abc123 / input type=text name=qty[] value=1 / input type=hidden name=sku[] value=abc321 / input type=text name=qty[] value=2 / on your POST $_POST['sku'] $_POST['qty'] will be arrays, and the ordering will be the same so you can be sure of what index position/sku the qty is for. On 9/14/07, Ji H. Park [EMAIL PROTECTED] wrote: *The question: How would you have multiple text input forms (on shopping cart page) with different inputted data (product quantities) submitted for querying the database (for changing the quantity of multiple products in the shopping cart at the same time)?*** *Here is an ideal example to clarify the matter:* When a customer wants to change quantities of multiple products all at once in the shopping cart, all the quantities has to be changed at the same time just by clicking a button called (e.g. Update Quantity). *Issue*: Currently I have update quantity buttons for each product, which isn't convenient. I would appreciate any tips, techniques, comments, or reference to any website regarding this issue at your repository, thanks!
RE: [PHP] About MYSQL/PHP Shopping Cart's Product Quantity Change Input Forms
*The question: How would you have multiple text input forms (on shopping cart page) with different inputted data (product quantities) submitted for querying the database (for changing the quantity of multiple products in the shopping cart at the same time)?*** easy, you can cause multiple text fields on the form with php compatible array names. Say you have a list of line items from your cart table and the record ids (artificial keys of the cart table could be used in the index). Here is a sample couple of text fields; input type=text name=quantity[5] value=1 input type=text name=quantity[14] value=3 input type=text name=quantity[8] value=1 the number 5, 14, and 8 represent the keys of the rows from your cart table and when you pull the value from the post array after the user submits the form, of course in addition to the quantities you should show things like product descriptions and such on the same line as the quantity text box. $qtyupdates = $_POST[quantity]; $qtyupdates above becomes an array with 3 rows in it and the recordd ids are stored in the index. A simple foreach loop Foreach($qtyupdates as $idx = $qty) { $query = update cart_table set itemqty = .$qty . where cart_lineid = .$idx; mysql_query you get the rest } your form now becomes a list of line items with quantities in text boxes for each item, and a single submit button allows you to apply all changes at once. Hope this is clear enough, Warren Vail Vail Systems Technology http://www.vailtech.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] About MYSQL/PHP Shopping Cart's Product Quantity Change Input Forms
Ji H. Park wrote: *The question: How would you have multiple text input forms (on shopping cart page) with different inputted data (product quantities) submitted for querying the database (for changing the quantity of multiple products in the shopping cart at the same time)?*** *Here is an ideal example to clarify the matter:* When a customer wants to change quantities of multiple products all at once in the shopping cart, all the quantities has to be changed at the same time just by clicking a button called (e.g. Update Quantity). *Issue*: Currently I have update quantity buttons for each product, which isn't convenient. I would appreciate any tips, techniques, comments, or reference to any website regarding this issue at your repository, thanks! Don't provide a button at all. Place the quantity for each item in a text input field so that it may be edited by the user before submission. I'm guessing that your page may presently be showing the details of the item(s) as, say, a regular HTML table, with hidden form fields for the data. But, instead of having the quantity hidden, place it in a normal field. This way, any, all, or none of the quantities may be updated in one POST. Or, if your cart resides solely in $_SESSION, you may still provide the quantity fields and update later. brian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php