Nymphetamine Posted August 11, 2008 Share Posted August 11, 2008 ??? Hi guys, Can't believe I'm having to write a topic for such a newbie question but I couldn't find anything on the net or even think of what to search for... I want it so that... if (suchandsuch) $this = "that" AND echo "something"; How do I get an if statement to do two things? I tried "&&" and various things but didn't work haha... Sorry for being such a noooob >.< Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted August 11, 2008 Share Posted August 11, 2008 I'm not quite following you... Sorry. Quote Link to comment Share on other sites More sharing options...
waynew Posted August 11, 2008 Share Posted August 11, 2008 if (suchandsuch){ $this = "that"; echo "something"; } Quote Link to comment Share on other sites More sharing options...
Nymphetamine Posted August 11, 2008 Author Share Posted August 11, 2008 I want the first "if" to do two different things... if ($number=="1") echo "Something" + $something = "something else"; elseif ($number=="2") etc... Not... if ($number=="1") echo "Something"; elseif ($number=="2") etc... waynewex - I tried that and it doesnt work... Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted August 11, 2008 Share Posted August 11, 2008 Well, waynewex was spot on then... if($number == 1){ echo "The number is 1"; $var = "Something"; }elseif($number == 2){ echo "The number is 2"; $var = "Something else..."; } Quote Link to comment Share on other sites More sharing options...
waynew Posted August 11, 2008 Share Posted August 11, 2008 You're doing something wrong somewhere else. What is given to this IF statement? And what do you plan to do? Quote Link to comment Share on other sites More sharing options...
Nymphetamine Posted August 11, 2008 Author Share Posted August 11, 2008 Oops! Forgot the lil "{" haha Thanks! Quote Link to comment 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.