passing variables between php forms
| From: | baldey_uk | Date: | Thu, 09 May 2002 23:41:28 +0000 |
| Subject: | passing variables between php forms | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-96883@lists.php.net to get a copy of this message | ||
Hi sorry to annoy you AGAIN, but i cant seem to get it working.... i think
its something to do with the order that i put things in:
#end of html and start of php script
<?php
#Take the Variables from enterdetails.php that are posted from an html form
$firstname=$_POST['txtFirstName'];
$lastname=$_POST['txtLastName'];
$email=$_POST['txtEmail'];
$quantity=$_POST['txtJars'];
$order_value=sprintf('%.2f', floatval($_POST['txtJars'])*7.0);
echo '<INPUT type="hidden" name="testvar"
value="'.$order_value.'" />';
?>php
# end of php script back into html
Are your details correct?
<tr>
<td valign="top" colspan="3" align="center"><form
action="confirm.php"
method="post"><input type="Submit" name="submit"
value="Yes"></form></td>
</tr>
<tr>
<td valign="top" colspan="3" align="center"><form
action="updateaddress.php" method="post"><input type="submit"
value="No "></form></td>
</tr>
</font>
If i put the echo or INPUT type outside of the php script this works, but
obviously just returns a string '.$quantity.' and not waht the variable
$quantity holds. This is extremely confusing. How do i get this php variable
to be passed to the HTML so it can be posted I thought the way i have it
the echo would make the variable testvar available to the browser, and then
i would be able to retrieve it by $_POST[testvar]; or $_POST[$testvar]; in
either the confirm.php or updateaddress.php that the html posts to?
Yet again thanks in advance for any help.
Confused
Cheers From
baldey_uk