wmguk Posted August 20, 2007 Share Posted August 20, 2007 Hi again My code is <?php if ($pass == "") { $password == "X"; } $password = $pass ; echo "$password" ; ?> Im trying to get it, so that if the password field is blank, it sets $password as X, but if the password has something in it, it will show it... the show $password works if i enter a password, but i cannot get it to show X Im sure this is a stupid question but itis 04.20am and im about done i think.... Quote Link to comment https://forums.phpfreaks.com/topic/65764-solved-echo-statement-help/ Share on other sites More sharing options...
dbo Posted August 20, 2007 Share Posted August 20, 2007 $password = "X"; if you use == you're doing comparison not assignment. Quote Link to comment https://forums.phpfreaks.com/topic/65764-solved-echo-statement-help/#findComment-328534 Share on other sites More sharing options...
MadTechie Posted August 20, 2007 Share Posted August 20, 2007 either <?php if ($pass == "") { $password = "X"; }else{ $password = $pass ; } echo "$password" ; ?> or <?php $password = $pass ; if ($pass == "") { $password = "X"; } echo "$password" ; ?> or <?php $password = $pass ; if (empty($pass)) { $password = "X"; } echo "$password" ; ?> Quote Link to comment https://forums.phpfreaks.com/topic/65764-solved-echo-statement-help/#findComment-328535 Share on other sites More sharing options...
wmguk Posted August 20, 2007 Author Share Posted August 20, 2007 excellent, thank you, im now going to bed, cause im making stupid mistakes, Thanks again Quote Link to comment https://forums.phpfreaks.com/topic/65764-solved-echo-statement-help/#findComment-328538 Share on other sites More sharing options...
MadTechie Posted August 20, 2007 Share Posted August 20, 2007 trust me you don't need to be tired to make stupid mistakes but it helps.. infact 4:30am.. i'm out too night all! Quote Link to comment https://forums.phpfreaks.com/topic/65764-solved-echo-statement-help/#findComment-328539 Share on other sites More sharing options...
wmguk Posted August 20, 2007 Author Share Posted August 20, 2007 Im not doing too badly considering when i started this at 8pm i couldnt even get sessions to work lol, this is such a monster of a site, but my god, what a challenge lol... just got loads of stupid niggles, like the other thread where its not displaying anything at all.... Quote Link to comment https://forums.phpfreaks.com/topic/65764-solved-echo-statement-help/#findComment-328543 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.