[thelist] Can't submit form data with 'enter' key in IE

Max Schwanekamp lists at neptunewebworks.com
Wed Mar 8 14:22:24 CST 2006

Jim Davis wrote:
> I originally used POST, but to make the pager routine to work I had to use
> this:
> $recordstart = (isset($_GET['recordstart'])) ? $_GET['recordstart'] : 0;
> In order to make this to work I had to change POST to GET. It seems POST and
> GET will not coexist in the same php script, at least in this case.

No, the superglobals ($_GET, $_POST, $_COOKIE, $_SESSION, $_SERVER) are 
always available and always coexist in all php scripts (at least since 
PHP 4), whether you access them or not.

You posted the pager script block, but not the part of your code that is 
checking for the existence of the relevant form variables.  Since your 
form consists of just one search item, agent_name, then your server-side 
validation should be checking for that value only.  Whether you use GET 
or POST is irrelevant in this case.

Unless the value of the button input is significant, it's best to just 
ignore it in your PHP.  Somewhere there's a conditional in your PHP code 
that's looking for $_GET['submit'] (or 'btnSubmit' or whatever).  Modify 
that code to look for $_GET['agent_name'] only and you should be good to 
go.  Also, I'd suggest you send your search data with POST.  There is no 
reason that would preclude using GET for your paging parameters.

If this isn't clear, how about posting more of your code?  If it's too 
long, you can reply off-list.

Max Schwanekamp

More information about the thelist mailing list