Christopherx Posted December 7, 2012 Share Posted December 7, 2012 (edited) Hey there guys. Right my problem is pretty straight forward, but it's a bit of a catch-22! I have a table, that displays products in it. At the end I have a query string link to add to the basket, that passes the product ID of the item to pass. This morning I decided to implement a feature to allow users to select more than one of the same item via a quantity text box, and then hit the query string. Now I realise that I can't update the query string inside the HTML form, so I've been trying to work out how to get the value in the text box by deducing it from the user ID. My attempt was: Set the method of the form to "get" Append the username onto the end of it's corresponding quantity textbox. The query string still passes the value of the product ID to the .php file. When I hit the php file, I grab the product ID, and GET the value in the text box. Then I go about my business. Alas, it doesn't fire the form, the Textbox isn't loaded into the GET array until a submit button is clicked. The problem is if I hit a submit button, then I lose the product ID being passed to the .php file and can no longer identify the relevant textbox. This IS for a University coursework project; I've posed on a few forums and I know that's important Any help would be much appreciated! Thankyou very much guys Edited December 7, 2012 by Christopherx Quote Link to comment https://forums.phpfreaks.com/topic/271715-php-post-get-problems/ Share on other sites More sharing options...
PFMaBiSmAd Posted December 7, 2012 Share Posted December 7, 2012 The simplest and most straight-forward method, if you want individual 'add to basket' links/buttons, one per product, and a quantity text box per product, would be to make a form for each product and change the existing link into a submit button for the form. The submitted text box would be the quantity and you would pass the id value as a hidden field in the form. Quote Link to comment https://forums.phpfreaks.com/topic/271715-php-post-get-problems/#findComment-1398115 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.