• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do I pass form data as a URI segment?

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

You can turn on query strings in the config.php file,

$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


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.

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
$input->get( 'someVariable' );

so i guess that means there's no way to do it without query strings. I wanted something like this:

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.