I am working for a school project written in PHP for some weeks and i am stuck.
I am using for my structure a page index.php?page=.... where page could be home , game, aboutus,contact etc.
Now I am in index.php?page=game
and I want to send using a form with GET method some parameters like game_name, created_by and stage_paused. Here comes the problem because when I press the Submit button I lose my "page=game"
parameter and is something like index.php?game_name=...&created_by=....
, and I don't have anymore my page=game, and by default my script check the page parameter and if not it renders the home page.
I checked w3 standards and they say that GET method shoud APPEND my form parameters with the one that is specified in the action =""
on the form, but in my case I lose my page parameter.
I don't get it why it doesn't remember my current parameters when I submit the form.
I would appreciate very much your help and sorry for my bad english.
Thanks !
Add the page parameter to either:
<form>
action URL, or<form>
as a hidden <input>
element, like so:<input type="hidden" name="page" value="<?= $_GET['page'] ?>" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With