So I have a profile page: profile.php?pin=xx, where I use the GET method for determining which profile to display. I am going to test if $_SESSION['pin'] == $_GET['pin'] and if so, give the option to edit profile.
I don’t want to write a-whole-nother script and direct the user to another page. So for usability sake, and keeping the server neat so I’m not always guessing which script does what, I want to mix POST and GET. I’ve done some research and it seems legal, but how?
<form method="post" action="profile.php?pin=xx">
<form method="post" action="<? echo $_SERVER['PHP_SELF']; ?>">
That’s all I can think of without really getting the code messy.
If you keep the action attribute empty it will be the same URI including the GET parameters (query-info part of the URI):
Maybe this is what you’re looking for? See HTML
<form>tag for a reference about tag and attribute.If you want to understand how that works: This is a so called Relative URI. It resolves to the Base URI of the document. As the Relative URI is empty, the Base URI is being taken over completely.