Re: Re: Best way to test for form submission?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2009-08-28 at 11:29 -0400, tedd wrote:
> At 3:10 PM +0100 8/28/09, Stuart wrote:
> >2009/8/28 Eric <blueray2048@xxxxxxxxx>:
> >  > Here is another way
> >>
> >>  if (isset($_POST['username'])  && $_POST['username'] != '')
> >>  { ...
> >
> >If you use this method then you'll completely ignore a form submission
> >if they've forgotten to enter a username. Detection and validation are
> >two distinct steps and should be treated as such.
> >
> >-Stuart
> 
> 
> I usually treat forms this way:
> 
>     $action = isset($_POST['action']) ? $_POST['action'] : null;
> 
> and then deal with $action.
> 
> Dealing with $action means that I might clean/scrub it for storage in 
> MySQL, or use it to determine a course of processing, or any number 
> of other things.
> 
> The point is to check IF a $_POST has occurred, without triggering an 
> error if it hasn't, and to deal with the outcome either way.
> 
> Cheers,
> 
> tedd
> 
> -- 
> -------
> http://sperling.com  http://ancientstones.com  http://earthstones.com
> 

I have noticed a bug with using a form element named action, which
funnily enough only effects IE. If you need to do anything to or based
on that action element in IE with Javascript, it has a lot of problems
differentiating the form element from the form action attribute, and
gets them a bit confused. It's similar to the IE name/id bug.

Thanks,
Ash
http://www.ashleysheridan.co.uk




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux