Ok, I am a beginner and I wrote this script. I dont know but it gives me a notice of "Undefined Index" for all the variables that I have declared here. Please look through it.
<html>
<title>A silly Poem</title>
<body>
<h2><u><i>Enter the following to read a story</h2></b></i><br><br><br>
<form method="post"
action="poem.php">
<h4>Enter your name:
<input type="text"
name="UserName"
value=""><br>
Enter your age:
<input type="text"
name="Age"
value=""><br>
Enter your sex:
<input type="text"
name="Sex"
value="boy or girl"><br>
Enter your favorite color:
<input type="text"
name="FavColor"
value=""><br>
Enter your favorite animal:
<input type="text"
name="FavAnimal"
value=""><br>
Enter your best friend's name:
<input type="text"
name="Friend"
value=""><br>
Enter the name of your favorite movie:
<input type="text"
name="FavMovie"
value=""><br>
Enter the name of your favorite actor:
<input type="text"
name="FavActor"
value=""><br>
<input type="submit"
value="Submit"><br><br><br><br><center>
<?php
$UserName=$_POST['UserName'];
$Age=$_POST['Age'];
$Sex=$_POST['Sex'];
$FavColor=$_POST['FavColor'];
$FavAnimal=$_POST['FavAnimal'];
$Friend=$_POST['Friend'];
$FavMovie=$_POST['FavMovie'];
$FavActor=$_POST['FavActor'];
if ($Sex=="boy"){
print "Once upon a time there was a boy named $UserName. He was $Age years old. $UserName 's favorite color was $FavColor. He had a pet $FavAnimal.
His best friend's name was $Friend. One day, they both went to watch $FavMovie together. To their surprise, they saw $FavActor.
They were sooo happy, they took the autograph and returned home happily.";
}
else{
print "Once upon a time there was a girl named $UserName. She was $Age years old. $UserName 's favorite color was $FavColor. She had a pet $FavAnimal.
Her best friend's name was $Friend. One day, they both went to watch $FavMovie together. To their surprise, they saw $FavActor.
They were sooo happy, they took the autograph and returned home happily.";
}
?>
</form>
</body>
</html>