Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter urls
#1

[eluser]georgerobbo[/eluser]
Hello,

I would just like some clarification on the CodeIgniter url module. If I developed a simple search form in standard php using the GET method, I would get a standard query string such as
Quote:http://localhost/index.php?id=2
. If I did the same in CodeIgniter, would it automatically rewrite the url to something like
Quote:http://localhost/index.php/welcome/search/2
.
#2

[eluser]cahva[/eluser]
Yes. If you used that url, you would have method named search in the Welcome controller with a parameter $id for example. Heres a cup of RTFM Wink
#3

[eluser]ggoforth[/eluser]
To answer the second part of your question, no codeigniter will not automatically rewrite your URLS. If you submit a form using GET you are going to get your first URL (?id=2). You need to craft your URLS properly, using POST for form submits, etc... That said, as cahva pointed out, using your second URL codeigniter would properly route you to the Welcome controller and the Search method passing it a variable that in your case, equals 2.




Theme © iAndrew 2016 - Forum software by © MyBB