Errors in php 5.0.4 Not in 4.3.10-16

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I use the following statements:

$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?

Han koster

Re: Errors in php 5.0.4 Not in 4.3.10-16

Han Koster wrote:
Quoted text here. Click to load it

It depends on php.ini

Do it like this, and you will never see an ugly notice again:

$var = isset($_POST['varname']) ? $_POST['varname'] : "";

Site Timeline