Show Source Code


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<!--
The Chinese Zodiac
Amy Tavakouli
May 21, 2014
BirthYear_ifelse.php


-->




<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Birth Year Fun If Else</title>

    <style>
        form
        {
            width: 400px;
            margin: 100px auto;
            margin: 1em auto;
            padding:0 2em 2em 2em ;
            border:1px solid #bbb;
            color: #333;
            background:#db7acc;
            font: 0.9em verdana, sans-serif;
        }
        FORM
        {
            width: 300px;
            margin: 100px auto;
            margin: 1em auto;
            padding:0 2em 2em 2em ;
            border:1px solid #bbb;
            color: #333;
            background:#db7acc;
            font: 0.9em verdana, sans-serif;
        }
        
        
        body
        {
            width: 400px;
            margin: 100px auto;
            margin: 1em auto;
            padding:0 2em 2em 2em ;
            border:1px solid #bbb;

            font: 0.9em verdana, sans-serif;
        } 
        
    </style>

</head>
   
   
   
   
<body>
<strong><h2 class="auto-style1" align="center"><font color="Magenta">THE CHINESE ZODIAC</font></h2>
<h3 class="auto-style1" align="center"><font color="Magenta">IF ELSE</font></h3>
</strong>
<?php


$DisplayForm 
TRUE;
$BirthYear "";
$Counter 0;


$Monkey "<td align=\"center\"><img src=\"Images/MONKEY.jpg\"></td>";
$Goat "<td align=\"center\"><img src=\"Images/GOAT.jpg\"></td>";
$Horse "<td align=\"center\"><img src=\"Images/HORSE.jpg\"></td>";
$Ox ="<td align=\"center\"><img src=\"Images/OX.jpg\"></td>";
$Pig "<td align=\"center\"><img src=\"Images/PIG.jpg\"></td>";
$Hare "<td align=\"center\"><img src=\"Images/HARE.jpg\"></td>";
$Rat "<td align=\"center\"><img src=\"Images/RAT.jpg\"></td>";
$Rooster "<td align=\"center\"><img src=\"Images/ROOSTER.jpg\"></td>";
$Snake "<td align=\"center\"><img src=\"Images/SNAKE.jpg\"></td>";
$Tiger "<td align=\"center\"><img src=\"Images/TIGER.jpg\"></td>";
$Dragon "<td align=\"center\"><img src=\"Images/DRAGON.jpg\"></td>";
$Dog "<td align=\"center\"><img src=\"Images/DOG.jpg\"></td>";






if (isset(
$_POST['Submit'])) {
    
$BirthYear $_POST['BirthYear'];
    if (
is_numeric($BirthYear)) {
        
$DisplayForm FALSE;
         echo 
"<p><center>You were born in " $BirthYear".</center></p>\r\n";
         
         
                
$BirthSign $BirthYear%12;
                if (
$BirthSign==0){
                echo 
"<p><center>You were born under the sign of the Monkey.</center></p><br />\n";
                echo 
"<p><center>" $Monkey "</center></p>";
                
                }
                else
                    if (
$BirthSign==1) {
                    echo 
"<p><center>You were born under the sign of the Rooster.</center></p><br />\n";
                    echo 
"<p><center>" $Rooster "</center></p>";
                    }
                    else
                        if (
$BirthSign==2) {
                            echo 
"<p><center>You were born under the sign of the Dog.</center></p><br />\n";
                            echo 
"<p><center>" $Dog "</center></p>";
                            }

                        else
                            if (
$BirthSign==3) {
                                echo 
"<p'><center>You were born under the sign of the Pig.</center></p><br />\n";
                                echo 
"<p><center>" $Pig "</center></p>";
                            }

                            else
                                if (
$BirthSign==4) {
                                        echo 
"<p><center>You were born under the sign of the Rat.</center></p><br />\n";
                                        echo 
"<p><center>" $Rat "</center></p>";
                                    }

                                else
                                    if (
$BirthSign==5) {
                                        echo 
"<p><center>You were born under the sign of the Ox.</center></p><br />\n";
                                        echo 
"<p><center>" $Ox "</center></p>";
                                    }

                                    else
                                        if (
$BirthSign==6) {
                                            echo 
"<p><center>You were born under the sign of the Tiger.</center></p><br />\n";
                                            echo 
"<p><center>" $Tiger "</center></p>";
                                            }

                                            else
                                                if (
$BirthSign==7) {
                                                echo 
"<p><center>You were born under the sign of the Hare.</center></p><br />\n";
                                                echo 
"<p><center>" $Hare "</center></p>";
                                                }

                                            else
                                                if (
$BirthSign==8) {
                                                    echo 
"<p><center>You were born under the sign of the Dragon.</center></p><br />\n";
                                                    echo 
"<p><center>" $Dragon "</center></p>";
                                                }

                                                else
                                                    if (
$BirthSign==9) {
                                                        echo 
"<p><center>You were born under the sign of the Snake.</center></p><br />\n";
                                                        echo 
"<p><center>" $Snake "</center></p>";
                                                    }                        

                                                    else
                                                        if (
$BirthSign==10) {
                                                            echo 
"<p><center>You were born under the sign of the Horse.</center></p><br />\n";
                                                            echo 
"<p><center>" $Horse "</center></p>";
                                                        }            

                                                            else
                                                                if (
$BirthSign==11) {
                                                                    echo 
"<p><center>You were born under the sign of the Goat.</center></p><br />\n";
                                                                    echo 
"<p><center>" $Goat "</center></p>";
                                                                }   
                                                                
    echo 
"<FORM><p align='center'><INPUT Type='button' VALUE='Go Back' onClick='history.go(-1);return true;'></p></FORM>\n";    
        }
         
    else
        {
            echo 
"<p><center>You need to enter a numeric value between 1924 and 2031.</center></p>\n";
            
$BirthYear "";
            
$DisplayForm TRUE;
        }
    }
if (
$DisplayForm) {
    
?>
    <form name="BirthYear_ifelse" action="BirthYear_ifelse.php" method="post">
    <p>Year of Birth: <input type="text" name="BirthYear" value="<?php echo $BirthYear?>" /> </p>
    <p><input type="submit" name="Submit" value="Enter" /></p>
    <p><input type="reset" name="Clear" value="Clear Form" />&nbsp;&nbsp;

    </form>
    <FORM><p align='center'><INPUT Type="button" VALUE="Go Back" onClick="history.go(-1);return true;"></p></FORM>
<?php
}
else
{
    
$Dir "Statistics";
    if (
is_dir($Dir)) {
        
chdir("Statistics");
        
        If (
file_exists($BirthYear.".txt"))
            
$Counter file_get_contents($BirthYear.".txt");
        else
            
$Counter 0;
        
        
$Counter = ++$Counter;
        echo 
"<p><center>You are person " $Counter " to enter the year " $BirthYear".</center></p>";
        
file_put_contents($BirthYear.".txt",$Counter);
        }
        
    else
        {
        
mkdir("Statistics");
        
chdir("Statistics");
        
$Counter 1;
        echo 
"<p><center>You are person " $Counter " to enter the year " $BirthYear".</center></p>";
        
file_put_contents($BirthYear.".txt",$Counter);
        }
    }
?>
<br>
<?php
include("include/inc_text_links.php");
?>
<br>
</body>

</html>