Star Sign

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
ben
Forum Newbie
Posts: 1
Joined: Mon Mar 24, 2003 9:32 pm

Star Sign

Post by ben »

I want to create a script where people could type in their Date of Birth
and then there star sign would come up

Is this difficult and what is the process


Ben :lol:
phpfreak
Forum Commoner
Posts: 30
Joined: Fri Mar 21, 2003 10:28 am
Location: New Jersey,USA
Contact:

hi there

Post by phpfreak »

hi ben
i think this should help you, mail me if this is not what you want:

<html>
<head>
<script language="JavaScript">
function display_sign()
{
var month_entered=document.form1.monthnumber.value;


var signarray=new Array(12);

signarray[0]="Aries";
signarray[1]="Taurus";
signarray[2]="Gemini";
signarray[3]="Cancer";
signarray[4]="Leo";
signarray[5]="Virgo";
signarray[6]="Libra";
signarray[7]="Scorpio";
signarray[8]="Sagittarius";
signarray[9]="Capricorn";
signarray[10]="Aquarius";
signarray[11]="Pisces";


if((month_entered>0)&&(month_entered<=12))
{


for (count=0;count<12;count+=1)
{
if(count==month_entered-1)
{

document.write("Your sign is:"+ signarray[count]);

}
}
}

else
{
window.alert("please enter the month from 1 to 12");
document.form1.monthnumber.focus();
}


}
</script>
</head>
<body>
<form name="form1" onSubmit="display_sign();">
Month:<input type="text" name="monthnumber"><br>

<input type="submit" value="submit">
</form>
</body>
</html>


with regards
srinivas
Post Reply