Jump to content

[SOLVED] checkbox problem...


pfkdesign

Recommended Posts

hi i dont know what's wrong with this code,

 

 $return .= '<input id="mtm_'. $myItem['itemURL'] .'" name="mtm_'. $myItem['itemURL'] .'" type="checkbox" value="1" '. if ($row_rsmenu['id'] != "") { echo "checked"; }' />';

 

as soon as i put "if"statement, i will get the "Syntax error, unexpected T_IF"

i dont know where is the problem,

any idea? ???

 

Link to comment
https://forums.phpfreaks.com/topic/121761-solved-checkbox-problem/
Share on other sites

you can't append the result of an if statement like you're trying to do.

 

$return .= '<input id="mtm_'. $myItem['itemURL'] .'" name="mtm_'. $myItem['itemURL'] .'" type="checkbox" value="1" ';

if ($row_rsmenu['id'] != "") { 
     $return .= "checked";
}

$return .= ' />';

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.