Hi guys.
I am currently trying to complete an exercise in a php book i am reading.
Here is my code:
if ( isset( $_POST["sendNumber"] ) ) {
processNumber();
} else {
displayForm();
}
processNumber() {
$numberToGuess = rand( 1, 100 );
if ( isset( $_POST["number"] ) && $_POST["number"] != $numberToGuess ) {
echo "incorrect number, please try again.";
} else {
thanks();
}
}
displayForm() {
?>
<h1>Guess the number</h1>
<form action="chapter9_mytry1.php" method="post">
<input type="text" name="number" value="">
<input type="submit" name="sendNumber" value="send me">
</form>
<?php
}
thanks() {
?>
<h2>congratualtions, you are the winner!"</h2>
<?php
}
..... the problem I am having is the following error that keeps showing when i load the page:
Parse error: syntax error, unexpected '{' in C:\wamp\www\phpsite1\chapter9_mytry1.php on line 32
It just doesn't make any sense. I clearly haven't over-used or under-used curly brackets have I?
So why do i keep getting this error?
Paul.