cfisher cfisher - 4 months ago 11
PHP Question

Weird PHP error: 'Can't use function return value in write context'

I'm getting this error and I can't make head or tail of it.

The exact error message is:


Fatal error: Can't use function return
value in write context in
/home/curricle/public_html/descarga/index.php
on line 48


Line 48 is:

if (isset($_POST('sms_code') == TRUE ) {


Anybody knows what's going on???

PS Here's the full function, in case it helps:

function validate_sms_code() {

$state = NOTHING_SUBMITED;

if (isset($_POST('sms_code') == TRUE ) {
$sms_code = clean_up($_POST('sms_code'));
$return_code = get_sepomo_code($sms_code);

switch($return_code) {

case 1:
//no error
$state = CORRECT_CODE;
break;

case 2:
// code already used
$state = CODE_ALREADY_USED;
break;

case 3:
// wrong code
$state = WRONG_CODE;
break;

case 4:
// generic error
$state = UNKNOWN_SEPOMO_CODE;
break;

default:
// unknown error
$state = UNKNOWN_SEPOMO_CODE;
throw new Exception('Unknown sepomo code: ' . $return_code);
break;
}

} else {
$state = NOTHING_SUBMITED;
}
dispatch_on_state($state);
}

Answer

You mean

if (isset($_POST['sms_code']) == TRUE ) {

though incidentally you really mean

if(isset($_POST['sms_code'])) {
Comments