I've got a little issue with my forms, and I was just hoping you could have an answer to my problem.
Basically, there is an index.php
which contains the pages header, footer, and between those, I've put a require $_GET['page'].'.php';
All my pages have links going to index.php?page=pagename
, and it's been working almost perfectly.
My only issue is that the page variable doesn't go through forms which send other variable through $_GET
, although if the form is empty or has variables going to the next page through $_POST
, it will work great. whenever I try to pass $_GET['page']
through to an other page using the url right into the action quotes, it just wont work, the form variables will show in the var_dump()
but page will not. Here is the code, which is in my opinion really not that important.
index.php :
if (!isset($_GET['page'])) //This returns TRUE
{
echo redirect_tempo(500, 'index.php?page=home');
}
elseif ($_GET['page']=="index")
{
echo redirect_tempo(500, 'index.php?page=home');
}
elseif (file_exists($_GET['page'].".php"))
{
require $_GET['page'].'.php';
}
else
{
echo redirect_tempo(500, 'index.php?page=404');
}
test.php
<form action="index.php?page=test" method="GET">
Obtenir les disponibilités des hôtels pour la date suivante :
<input type="text" name="date" size="12" id="inputField" /><br /><br />
<input type="submit" value="Rechercher" />
</form>
In that case var_dump will only show $_GET['date']
I'm pretty sure it's a well known bug and pretty stupid mistake, but I really couldnt find anything on the internet (not easy to look for...)
Thank you so much for your help :)
Bastien