Page 1 of 1

Why this code doesn't work?

Posted: Tue Jan 26, 2010 6:21 am
by mariolopes
filename minhagrid.php
<?php
echo"<form action='minhagrid.php?Codigo=";echo"8'";echo " method='GET'>";
echo" <fieldset>";
echo" <legend>Pesquisa:</legend>";
echo" Código: <input type='text' size='10' /><br />";
echo" Designação: <input type='text' size='30' /><br />";
echo" <input type='Submit' value='Pesquisar'/>";
echo" </fieldset>";
echo"</form>";
?>
The form action goes to minhagrid.php and not minhagrid.php?Codigo=8
Btw the file returns to his self, but i need the parameter Codigo=8
Any help?

Re: Why this code doesn't work?

Posted: Tue Jan 26, 2010 6:32 am
by requinix
When the form uses method=get it'll overwrite what you put in the action.

Code: Select all

<?php
echo"<form action='minhagrid.php' method='GET'>";
echo" <input type='hidden' name='Codigo' value='8'>";
echo" <fieldset>";
echo" <legend>Pesquisa:</legend>";
echo" Código: <input type='text' size='10' /><br />";
echo" Designação: <input type='text' size='30' /><br />";
echo" <input type='Submit' value='Pesquisar'/>";
echo" </fieldset>";
echo"</form>";
?>

Re: Why this code doesn't work?

Posted: Tue Jan 26, 2010 6:43 am
by mariolopes
It works with post.
Thank you