Re: help w/hidden fields and storing an int.

From: Date: Mon, 17 Jan 2005 22:54:14 +0000
Subject: Re: help w/hidden fields and storing an int.
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-25363@lists.php.net to get a copy of this message
Patrick Roane wrote:
I am tring to store and display the number of requests that a user has submitted via a hidden field. I've created a form that does a some simple addtion. Everything works, but I need some direction as to how I can store each number the user puts in and to display them. Please see below: <?php if ( ! isset( $_POST['number1'] ['number2'] ) ) { $message = "Welcome to the numbers game!"; } $number1 = (int) $_POST['number1']; $number2 = (int) $_POST['number2']; $result = (int) $number1 + $number2; $num_selections = (int) $POST['num_selections']; $num_selections++; // this is my attempt at collecting
This will only store the num_selections for *this request*. Each time you submit a form, it is a new request. To store information over requests most people would use session variables: http://www.php.net/manual/en/ref.session.php -- Teach a person to fish... Ask smart questions: http://www.catb.org/~esr/faqs/smart-questions.html PHP Manual: http://www.php.net/manual/en/index.php php-general archives: http://marc.theaimsgroup.com/?l=php-general&w=2

« previous php.windows (#25363) next »