p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > PHP/MySQL > Beginning PHP
I forgot my password Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Beginning PHP Beginning-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.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 26th, 2009, 12:22 AM
Registered User
Points: 58, Level: 1
Points: 58, Level: 1 Points: 58, Level: 1 Points: 58, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2009
Posts: 6
Thanks: 1
Thanked 1 Time in 1 Post
Post how to increase number of attempt

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!!!!!!";
}
?>

<html>
<head>
<title> Number guessing machine2.0 </title>
</head>
<body>
<h1>
<?php
echo $message;
echo "<br> Your tried $attempt times.";
?>
</h1>
<form action="<?php echo $_SERVER[PHP_SELF] ?>" method="POST">
<!-- <form action="guessnumber1.php" method="POST"> -->
Enter your number:
<input type="text" name="guess">
<input type="submit" value="Check">
</form>
</body>
</html>

************************************************** ******
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Choice of database's for attempt at commercializat TomW Access VBA 3 November 21st, 2008 09:08 AM
user function attempt demac43 Excel VBA 3 November 8th, 2006 05:59 PM
A connection attempt failed because the connected purtimalhotra .NET Web Services 0 February 5th, 2006 06:58 AM
Invalid Attempt deepaR BOOK: Professional SQL Server 2000 Programming 0 December 29th, 2004 02:52 AM
Please Help! Attempt to create a login page nvillare Classic ASP Basics 8 August 12th, 2003 10:06 PM



All times are GMT -4. The time now is 02:31 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc