0

I have this form:

<form name = "search" action="" method="GET">
    <input name="first" type="text" value="First"/>
    <input name="second" type="text" value="Second"/>
    <input name="submit" type="submit" value="Submit"/>
</form>

and following config file:

$config['allow_get_array'] = TRUE;
$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
$config['directory_trigger']= 'd'; // experimental not currently in use

But when I click submit, it is passing values as query string and not as URI segments. I need to have the URI segments enabled. How can I do this?

3
  • What I need is, when I click on Submit button, the URL should be changed to URI segments with submitted data instead of query string Commented Dec 30, 2013 at 11:54
  • I'm not sure if this can be done. Commented Dec 30, 2013 at 11:56
  • ellislab.com/codeigniter/user-guide/general/urls.html Commented Dec 30, 2013 at 11:57

1 Answer 1

2

If you want to pass all parameters as URI segments, then you just submit your form from controller. it will automatically convert your parameters into URI segments.

otherwise from View it is not possible to make as URI segments.

have a look at :http://ellislab.com/codeigniter/user-guide/general/controllers.html#passinguri

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks. But how can I prevent from passing the empty values in query string ? The GET method is needed as this will share the URL with people and they will get the same data
Ohk. Then try using jQuery function call on submit of form. on submitting FORM the jQuery function will serialize all data of your FORM. and manually made URI segments. then return to your window.location......

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.