[thelist] undefined php variable
Simon Willison
cs1spw at bath.ac.uk
Thu Jul 31 06:47:20 CDT 2003
Hi Tom,
Thursday, July 31, 2003, 2:16:54 AM, you wrote:
> I'm doing this:
> $aDate = $_POST['postdate'];
> and getting this:
> Notice: Undefined index: postdate in..
I always use the following idiom to avoid warnings like that:
$aDate = isset($_POST['postdate']) ? $_POST['postdate'] : false;
That sets $aDate to the data from $_POST['postdata'] if it has been
sent, and otherwise sets it to false.
Cheers,
Simon Wilison
--
http://simon.incutio.com/
More information about the thelist
mailing list