Basic PHP variable problem
Posted: Tue Nov 24, 2009 11:48 am
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.
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.
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]}";
}
}I have no clue how to go about doing this.