Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 11-19-2004, 04:17 PM   #1 (permalink)
ADZ
 
Master Techie

Join Date: May 2003

Posts: 2,233

ADZ is on a distinguished road

Send a message via Yahoo to ADZ
Default PHP - If & Else

I am going through some PHP tutorials and one thing I feel that i could benefit from is the Ifs and Elses...I have done some of the practice exams but I am looking for some help.

basically i have a page where you say your name
BOB
then you hit man or woman then next...

so i guess i need to make an if sex=man then display bla bla bla
if sex=woman then say bla bla bla

can anyone reccomend a place that I can learn that?
ADZ is offline  
Old 11-22-2004, 10:54 AM   #2 (permalink)
 
Ultra Techie

Join Date: Sep 2003

Location: Bamberg, Germany

Posts: 549

Iron_Cross

Send a message via ICQ to Iron_Cross Send a message via MSN to Iron_Cross Send a message via Yahoo to Iron_Cross
Default

Code:
<?php
    if($sex == "Man"){
        // Display whatever it is you want
    }else if($sex == "Woman"){
         // Display the other side
    }else{
          // $sex doesn't equal man or woman, so display something else
     }
?>
Hope this helps.
__________________

See today\'s Penny-Arcade!(May contain foul lanuage)
Pain is weakness leaving the body.

PM Me for my MSN
Iron_Cross is offline  
Old 11-22-2004, 11:16 AM   #3 (permalink)
ADZ
 
Master Techie

Join Date: May 2003

Posts: 2,233

ADZ is on a distinguished road

Send a message via Yahoo to ADZ
Default

i know the format for the statement. but what I need is for it then to go to man.php - when it goes to man.php i need it to remember valus such as OS, Shoe size...etc...

Thank you for your help though!
ADZ is offline  
Old 11-22-2004, 03:20 PM   #4 (permalink)
ADZ
 
Master Techie

Join Date: May 2003

Posts: 2,233

ADZ is on a distinguished road

Send a message via Yahoo to ADZ
Default

Code:
<?php

if($light == "sync"){
        echo "<p class='style1'>THERE IS SYNC!</p>";
		echo "<p class='style1'>Now, Can you see the user in the NOC Show callers?</p>";
		echo "<form id='NOC' name='NOC' method='post' action='realm.php'>
	  <select name='NOC'>
      <option value='yes'>Yes</option>
      <option value='no'>No</option>
      <option value='dontknow'>I dont know!</option>
    </select> 
";
	echo "<input type='submit' value='Next-&gt;' name='welcome'>";
	echo "</form>";
	if($NOC == 'yes'){
    			echo 'THEN RESET THE DARN THING';
    		}else if($NOC == 'no'){
     			echo 'uh oh';
    		}else{
     			echo 'I think it is time for you to quit!';
     }
		
    }else if($light == "nosync"){
         echo "NO SYNC!";
	}else if($light == "dead"){
         echo "THE LIGHTS ARE DEAD - SEE FUNERAL";
    }else{
          echo "If you are stuck, go to the KB!";
     }



?>

ADZ is offline  
Old 11-22-2004, 09:42 PM   #5 (permalink)
 
Ultra Techie

Join Date: Sep 2003

Location: Bamberg, Germany

Posts: 549

Iron_Cross

Send a message via ICQ to Iron_Cross Send a message via MSN to Iron_Cross Send a message via Yahoo to Iron_Cross
Default

You mean you need to remember values after submitting? Try useing the $_GET[] and $_POST[] variables. I would tell you all about it, but you'd get better information if you searched the internet for it, since it's been a while since I used them... sorry.
__________________

See today\'s Penny-Arcade!(May contain foul lanuage)
Pain is weakness leaving the body.

PM Me for my MSN
Iron_Cross is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On