Question

I have a post html form, and the action is index.php, which is the websites main page. I never actually have index.php in the address bar, since links to "/" go to it, and even if I did, it would be website.com/home(/), since I use rewrite rules. So basically, the user should never see index.php. However, the form submit doesn't work if the action isn't spefically index.php, "/" doesn't work, even though that resolves to index.php. Any ideas on how to get around this?

Was it helpful?

Solution

Don't specify the action. If the post is to the page they're on, the default action of the form is to post to that.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top