Basic PHP variable problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
aidoDel
Forum Newbie
Posts: 7
Joined: Mon Nov 23, 2009 11:32 am

Basic PHP variable problem

Post by aidoDel »

I have a html form where user enters birthday (day + month) and it is sent to be processed by php to calculate their star sign. Everything works fine but I'm unsure how to treat the data once sent.

Code: Select all

<?php
$Capricorn = array("Capricorn", "The sign Capricorn is one of the most stable and (mostly) serious of the zodiacal types.");
$Aquarius = array("Aquarius");
$Pisces = array("Pisces");
$Aries = array("Aries");
$Taurus = array("Taurus");
$Gemini = array("Gemini");
$Cancer = array("Cancer");
$Leo = array("Leo");
$Virgo = array("Virgo");
$Libra = array("Libra");
$Scorpio = array("Scorpio");
$Sagittarius = array("Sagittarius");
?>
   
<?php
    $user_month = $_POST['user_month'];
    $user_day = $_POST['user_day'];
    echo "Your birthday is {$user_day} of {$user_month} that makes your star sign ";
?>
<?php
// .........JAN = CAPRICORN or AQUARIUS........
if ( $user_month  == "January" ) {
    if ($user_day <= "19"){
    echo "{$Capricorn;[0]}";
    }
    else{
        echo "{$Aquarius[0]}";
    }
}
Rather than echo $Capricorn, I want to set the user_month to be $Capricorn so I can call it later.

I have no clue how to go about doing this.
Post Reply