mattosoft Posted May 27, 2008 Share Posted May 27, 2008 $mail= if($news== "on"){$mail="on"} ELSE{$mail="off"}; comes up with error when I try to use. Help greatly appreciated. Thanks, Matt. Link to comment https://forums.phpfreaks.com/topic/107395-solved-php-help-variables-and-if/ Share on other sites More sharing options...
The Little Guy Posted May 27, 2008 Share Posted May 27, 2008 Change this: $mail= if($news== "on"){$mail="on"} ELSE{$mail="off"}; To this: if($news== "on"){$mail="on"} else{$mail="off"}; Link to comment https://forums.phpfreaks.com/topic/107395-solved-php-help-variables-and-if/#findComment-550574 Share on other sites More sharing options...
trq Posted May 27, 2008 Share Posted May 27, 2008 <?php $mail = ($news == 'on') ? 'on' : 'off' ; ?> Link to comment https://forums.phpfreaks.com/topic/107395-solved-php-help-variables-and-if/#findComment-550579 Share on other sites More sharing options...
mattosoft Posted May 27, 2008 Author Share Posted May 27, 2008 works like a charm, thanks a lot Link to comment https://forums.phpfreaks.com/topic/107395-solved-php-help-variables-and-if/#findComment-550580 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.