Beginning PHPBeginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Beginning PHP section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
Hello friend, I am new user of this site. I saw so many questions and answer provided by you. That all are awesome. This is my Thread..
My question is how can i increase the number of attempts by user so that i can stop him after 3 or 4 attempts..... I am pasting the code. Please reply me..............
************************************************** *****
<?php
$message="";
$num = 23;
global $attempt;
$guess = $_POST['guess'];
$attempt = (isset($attempt)) ? ++$attempt : 0;
if($attempt > 3){
exit;
}
if (!isset($guess)){
$message = "Welcome to guessing machine.";
}
elseif( $guess < $num ){
$message = "Your guess is less than the original, Try again";
}
elseif( $guess > $num ){
$message = "Your guess is more than the original, Try again";
}
else{
$message = "You got the right answer. Congratulation!!!!!!";
}
?>