Hey leatherback,
First off, thanks for your response I really appreciate it. I realized my form was all messed up after I posted it and have since fixed it. Here is what I have come up with since I posted this, ( this is my complete code for the page )
<?php
// connect to db
$conn = mysql_connect('localhost','lotteryuser','password') or trigger_error("SQL", E_USER_ERROR);
$db = mysql_select_db('lottery',$conn) or trigger_error("SQL", E_USER_ERROR);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body>
<?php
$number = mysql_real_escape_string($_GET['number'], $conn);
$queryres = "Select lottonumber FROM lottery WHERE lottonumber = ['number']";
if ($queryres == $number)
echo "Congrats";
else "Sorry";
?>
<form action="" method="get">
<label name="enternumber" id="enternumber" value="Please enter number">Please enter number:</label>
<input type="text" name="lottonumber" id="lottonumber" />
<input type="submit" id="CehckResults" value="CheckResults"/>
</form>
</body>
</html>
<?php
mysql_close($conn);
?>
I have a couple of question about the code that you posted. I understand the $usernumber variable but I don't understand what ['usernumber'] is from/for? Is it the name I will give the input field the user will type the number into? Also where is the $q variable from?For the form I am using method="get". I just assuming this is correct since I am not posting anything. I hope that I am not confusing you, my ultimate goal is for a user to enter a number in the in the input field. Once they click the submit button it will check the DB to see if that number matches any number in the specified field within the DB. If the number exists then it will echo a Congrats message. If it doesn't then it will echo a Sorry message.
Again I truly appreciate your help in this.