How do I pass form data as a URI segment? - 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: How do I pass form data as a URI segment? (/showthread.php?tid=43925) |
How do I pass form data as a URI segment? - El Forum - 07-27-2011 [eluser]zulubanslee[/eluser] Forms send by post by default, I would like to pass the data in the URI so I have a pretty link. Is this a noob question? haha How do I pass form data as a URI segment? - El Forum - 07-28-2011 [eluser]Unknown[/eluser] You can turn on query strings in the config.php file, Code: $config['enable_query_strings'] = TRUE; Keep in mind though, when doing this your URI's will route differently, instead of symbollic links to your controllers and methods you'll run into the format Code: http://localhost/index.php/c=controller&m=method Check out this article on enabling query strings. Also, if you are using the Form helper, you can pass attributes to the form_open() method using a key value array. Setting a key/pair with method => get will do the trick. Code: form_open( $action, array( 'method' => 'GET' ) ) When using get, keep in mind that CI clears the $_GET array and stores the get variables internally, so when not using query strings the get variables can be recovered by using Code: $input->get( 'someVariable' ); How do I pass form data as a URI segment? - El Forum - 07-28-2011 [eluser]zulubanslee[/eluser] so i guess that means there's no way to do it without query strings. I wanted something like this: example.com/search/blah |