AW: [SMARTY] OT - Code help

From: Date: Tue, 10 Dec 2002 21:51:16 +0000
Subject: AW: [SMARTY] OT - Code help
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-6719@lists.php.net to get a copy of this message
Hi, you can't use 'if' in the middle of a print. User the ? : construct instead: print("<option value=" . $row_statusList['statusNum'] . ">" . ((!(strcmp($row_statusList['statusNum'], $projStatus))) ? "SELECTED" : $row_statusList['statusNum']) . "</option>"); Greets, Georges P.S. I still don't think this should be a PHP-Newbe-List... -----Ursprüngliche Nachricht----- Von: James Johnson [mailto:james@owell.com] Gesendet: Dienstag, 10. Dezember 2002 22:36 An: smarty-general@lists.php.net Betreff: [SMARTY] OT - Code help Hi, sorry for the off-topic but need a quick answer. What's wrong with this code? PHP gives me the following error: "parse error, unexpected T_IF" print("<option value=" . $row_statusList['statusNum'] . ">" if(!(strcmp($row_statusList['statusNum'], $projStatus))) {echo "SELECTED";} . $row_statusList['statusNum'] . "</option>"); Thanks, James Johnson

« previous php.smarty.general (#6719) next »