Re: [PHP] counter problem

2003-01-05 Thread Anthony Ritter
Hi Mike, I tried the first script you posted on the NG. This is what happens when I copy and paste your script: The formbox appears. I insert a number. I click submit. The number reverts back to 0. The URL script that you sent me works fine. I'm using MS Win 98/ Apache / PHP 4 Please advise

[PHP] counter problem

2003-01-04 Thread Anthony Ritter
The following script is found in Matt Zandstra's book on PHP (Sams) on page 160. He's explaining forms with PHP and has hard coded a value - 42. He also is explaining a hidden fleld where the user can submit the number and each time the user hits submit in the formbox, the counter will register

Re: [PHP] counter problem

2003-01-04 Thread Michael J. Pawlowsky
Use this... enjoy ?php $numtoguess=42; if (isset($_POST['num_tries'])) $num_tries = $_POST['num_tries'] + 1; $message=; if(!isset($_POST['guess'])) $message=Welcome to the guessing machine; elseif ($_POST['guess'] $numtoguess) $message=Your guess was too low.;

Re: [PHP] counter problem

2003-01-04 Thread Michael J. Pawlowsky
This also works with the ternary operator... I don't think it likes the ++ because it doesn't know the type yet. ?php $numtoguess=42; $num_tries = isset($_POST['num_tries'])?$_POST['num_tries']+1:0; $message=; if(!isset($_POST['guess'])) $message=Welcome to the guessing machine;

Re: [PHP] counter problem

2003-01-04 Thread Anthony Ritter
Michael J. Pawlowsky wrote in message: This also works with the ternary operator... . No dice Michael. I treid both your scripts. The formbox comes up. I enter a number. I hit submit. The box clears out the entered number without any

Re: [PHP] counter problem

2003-01-04 Thread Michael J. Pawlowsky
I won't keep it up long... but go here... you will see it works... http://rc.mikeathome.net:8080/test/index.php *** REPLY SEPARATOR *** On 04/01/2003 at 7:17 PM Anthony Ritter wrote: Michael J. Pawlowsky wrote in message: This also works with the ternary operator...