Re: passing variables between php forms
| From: | Bogdan Stancescu | Date: | Fri, 10 May 2002 00:27:29 +0000 |
| Subject: | Re: passing variables between php forms | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-96886@lists.php.net to get a copy of this message | ||
What exactly goes wrong? Indeed, you _should_ have $_POST["testvar"] available in the next page... The only problem I see is that you first echo the input and only then do you start the forms... which is an HTML problem, not a PHP one.
Bogdan
baldey_uk wrote:
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