CodeIgniter Forums
Using a form + uri segments? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Using a form + uri segments? (/showthread.php?tid=3125)



Using a form + uri segments? - El Forum - 09-11-2007

[eluser]Dauntless[/eluser]
Hi,

I have a list of products (=catalog) where you can order the products by entering the amount and pressing 'order'. Now, you click the 'order' button directly from the product list (and not from a separate product-page). I have a controller function 'addToCart' that accepts 2 arguments: productID & amount. How can I put these things to getter? The user has to fill in a number (the amount), press 'order' and it should go to 'addToCart/productID/amount' .

Can this be done? Or do I have to rewrite the 'addToCart' function so that it processes $_POST ?

Greets,
Dauntless


Using a form + uri segments? - El Forum - 09-11-2007

[eluser]coolfactor[/eluser]
$_POST would probably be better for this type of things. In order to submit those values into the url, you'd need some javascript to generate a dynamic url for the form's action attribute.


Using a form + uri segments? - El Forum - 09-12-2007

[eluser]Dauntless[/eluser]
I guess that's best... It's not like I want google to index a 'buy' page, so the url approach doesn't make a lot of sense Smile

Thank you.