I made it a little more straight forward for ya.
Code:
<?php
// If "Guess" is pressed
if(isset($_POST['submit'])) {
// Checks if guess field is empty
if($_POST['guess'] == "") {
// If empty, outputs this string
echo "Please fill in the field.";
} else {
// Checks if it's a number or not
if((int) $_POST['guess']) {
// Generates number
$number = rand(1, 10);
// Sets the guessed number as a variable
$guess = (int) $_POST['guess'];
// Compares guess to the generated number
if($guess != $number) {
// If incorrect, outputs this string
echo "Incorrect number, you guessed " . $guess . ". " . $number . " was the correct number";
} else {
// If correct, outputs this string
echo "We have a winner! " . $number . " is correct!";
}
} else {
// If it's not a number, outputs this string
echo "Please enter a number";
}
}
}
?>
I removed the higher lower stuff because it's randomly generated.