multiple FORMS on same page problem.
| From: | IndSys, GE Interlogix) | Date: | Mon, 15 Sep 2003 20:17:00 +0000 |
| Subject: | multiple FORMS on same page problem. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-162659@lists.php.net to get a copy of this message | ||
I am creating a page with 2 buttons. One which will refresh the page and the other that will go to
another page. My problem that I need to put all the values into $_POST and have access to when any
of the 2 buttons are clicked.
If I use the button in 2 seperate form tags I don't have access to all the values in $_POST.
Please look at the code below:
file (page4.php):
<html>
<form action="page4.php" method=post>
<?php echo "this is page 4"; ?>
<input type=text name='someVal' value=''">
<input type='submit' value='page4 Submit'>
</form>
<form action="page5.php" method=post>
<input type='submit' value='page5 Submit'>
</form>
</html>
file(page5.php):
<?php
$val = $_POST['someVal'];
echo $val;
echo "this is page 5";
?>
I would like to see the variable 'someVal' in the $_POST of both "page4 Submit"
button and "page5 Submit" button. This code is a simplified version of the more
complecated code where a tonnes of other values are involved. Any help is appreciated.
Moiz