Why this code doesn't work?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mariolopes
Forum Contributor
Posts: 102
Joined: Sun May 22, 2005 7:08 am

Why this code doesn't work?

Post 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?
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Why this code doesn't work?

Post 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>";
?>
mariolopes
Forum Contributor
Posts: 102
Joined: Sun May 22, 2005 7:08 am

Re: Why this code doesn't work?

Post by mariolopes »

It works with post.
Thank you
Post Reply