Hi all, Im very new to all this but keen to learn. In my first faltering steps i almost immediatly reach a dead end.
Ive set up all the apache2, PHP(4.3.1) and mysql fine on an XPproffesional os.
Great you all cry! Now the hard bit. Ive followed my PHP book, have grasped the consepts and got basic PHP scripts to run (rotating banner ect) I move on to the HTML forms part of the book. I construct the form in html(fav.html) so:
<html><head><title>Your Favourites</title></head>
<body>
<form action="fav.php" method="post">
<b>Please enter your first name:</b>
<input type="text" size="45" name="username"><br/>
<b>Please select your favourite colour wine:</b> <br/>
<input type="radio" name="colour" value="white"> White
<input type="radio" name="colour" value="rosé"> Rosé
<input type="radio" name="colour" value="red"> Red <br/>
<b>Please enter your favourite dish:</b>
<input type="text" size="45" name="dish"><br/><br/>
<input type="submit" value="Submit This Form">
</form>
</body></html>
point it to my script (fav.php) thus:
<html><head><title>Your submission</title></head>
<body>
<img src="foodbanner.jpg" width="368" height="54">
<?php
if($username != null)
{
echo("Thanks for your selection $username <hr/>");
}
if( ($colour != null) && ($dish != null) )
{
$msg="You really enjoy $dish<br/>";
$msg="- especially with a nice $colour wine";
echo($msg);
}
?>
</body></html>
but i keep getting an error:
Notice: Undefined variable: username in C:\Apache2\htdocs\fav.php on line 5
I understand its not lifting the variables but im not sure why?Ive followed the syntax to the letter but no obvious errors (im sure to some tho..lol)
To add to my confusion my book list changes and ammendments to concepts ive only just grasped
Please go easy on me as im keen to put the graft in but need help!
Regards