![]() |
Form help & receiving the data - 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: Form help & receiving the data (/showthread.php?tid=4654) |
Form help & receiving the data - El Forum - 12-07-2007 [eluser]Kinsbane[/eluser] Hi all! So, I've got a form that looks like this: Code: <form method="GET" action="/browse/category/" onchange="form.submit();"> I did a test switch, and when I do, the form submits and I get sent to /browse/category/ but my URL ends up being this: browse/category/?category=Category1 However, I would like it so that browse is my controller, category is the function, and the actual category is what gets passed, so the URL would end up looking like so: browse/category/Category1 Is something I need to change in the URI routing, or some other place? Or do I have to program my own solution to get what I'm looking for? My config is currently set to FALSE for $config['enable_query_strings'] Thanks! Form help & receiving the data - El Forum - 12-07-2007 [eluser]gtech[/eluser] try using Code: <form method="POST" action="<?=site_url()?>/browse/category/"> you should be using POST as opposed to GET in this instance, you might also want to take a look at the form and validation helpers. GETs are nasty as they send the form data through the URL, thats why you get the ?category=Category2 on the end. A POST will send the form data through the http request. If using the post method you can retrieve the data in the controller your posting to by doing Code: $category = $this->input->post('category', TRUE); site_url() will ensure the full URL is used (your config has to have base_url and index_page setup correctly. |