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
// and displaying the numbers 
?>


<!DOCTYPE html PUBLIC
        "-//W3C//DTD XHTML 1.0 Strict/EN"
        "http://www/w3/org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<html>
<head>
<title>form</title>

</head>
<body>
<h1>
<?php print $result ?>
</h1>
<form method="post" action="<?php print
$_SERVER['PHP_SELF']?>">
<p>
Type your number here: <input type="text"
name="number1" /><br />
Type your 2nd number here: <input type="text"
name="number2" /><br />
<p><input type="submit" value="submit" /></p>
<input type="hidden" name="num_selections"
value="<?php print $num_selections?>" />
        
</p>
</form>
</body>
</html>

thanks-

=====

----------------
"forget your lust for the rich man's gold. All that you need, is in your soul. 
You can do this if you try. All that I want for you my son, is to be satisfied"

  ~ Lynard Skynard

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to