I am using PHP. I want to create an MVC setup from scratch to learn more about how MVC works. I want to use clean urls with slashes as delimiters for the arguments. How do people do this when it comes to GET method forms? Or do people avoid GET method forms all together?
As of right now the ways I can imagine are:
- Don’t use GET method forms (although this makes it harder to let users bookmark/link in some cases).
- Use AJAX instead of form submission (although what do you do for SEO and JS disablers?).
- Have page submit to itself with post method, then reform the post vars into an url, then rerout to that url using headers (seems like wasted resources).
Any suggestions or suggested reading welcome.
Get variables and clean URLs don’t contradict each other. You can always have URLs like
An alternative URL style could also look like
In these 2 cases if you want to create these URLs via a form GET submit you will have to use JavaScript to assemble the correct URL therefore the very first solution might be easier to implement.
Another question is the decision between POST and GET form submission. POST is more secure but as you said, users can’t bookmark it.