What I have is that when someone clicks a link on my index it calls index.php?action=signup and that will display a signup form.
How do I then cause the signup form to maintain the action=signup portion of the query string so that when the user clicks “Submit” the new query string is index.php?action=signup&email=user@email.com?
What is the best way to set this up? Should I somehow split the actions into GET and the data into POST?
I am not sure if I am describing this correctly but I want to keep all my functions on the index.php so when I integrate .htaccess everything will be like www.site.com/signup, www.site.com/login and so on.
The best way to do this on a form submission is to change the
<form>action to the correct URL and the method toGET, like so:<form action="index.php?action=signup" method="GET">Then, hidden in your form, you put something like the following:
<input type="hidden" name="action" value="signup" />Then your URL will contain the correct parameters when it is submitted.
However, if you need to modify this server side, then you can get all of your query parameters via
$_SERVER['QUERY_STRING']. Use parse_str to get an array of values, and use http_build_query to recreate the query string:Example: