Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Errors in php 5.0.4 Not in 4.3.10-16
- Han Koster
September 28, 2005, 4:50 pm
rate this thread
$var = "";
$var = $_POST('varname');
In php 4, when 'varname' was not defined, $var remained an empty string;
In php 5, I suddenly get errors.
I solved these by including the function array_key_exist to check the
occurence of 'varname'
Is this the prefered way or is ther a better solution?
Re: Errors in php 5.0.4 Not in 4.3.10-16
You might have had display errors turned off in PHP 4.
It's always good to see if something exists before trying to use it. I
use isset($_POST['varname']), but I'm sure array_key_exist will work
My code looks something like:
$var = isset($_POST['varname']) ? $_POST['varname'] : 'default_value';
That way I can set a default - even if it is null.
Remove the "x" from my email address
JDS Computer Training Corp.