...

View Full Version : form



bunny1
03-24-2007, 03:00 AM
I have a form and on text field on it
In the action of the form i want to use the value of the field in the header.
How do i get this value from the form

Here is the code



<form action="cart.php?qty=<?php echo $_POST['qty']; >" method="post" name="form1" class="style15">
<p><strong>Quantity</strong>:<input name="qty" type="text" id="qty" value="1" size="2" maxlength="4"></p>
<p><input name="Submit" type="submit" value="Add to Cart"></p>
</form>

i have used $_POST but i dont know if this will take data from the previous page.

Thanks

Nightfire
03-24-2007, 03:06 AM
Use better descriptions in your subject title. 'Form' doesn't mean anything.

You'll be best to use GET



<form action="cart.php" method="get" name="form1" class="style15">
<p><strong>Quantity</strong>:<input name="qty" type="text" id="qty" value="1" size="2" maxlength="4"></p>
<p><input name="Submit" type="submit" value="Add to Cart"></p>
</form>

bunny1
03-24-2007, 03:18 AM
Thanks but to get the value of the "qty" textfield into the url in the form action how do i do that is it

<form action = "cart.php?qty=<?php echo $_GET['qty']; ?>"

Nightfire
03-24-2007, 03:22 AM
It goes into the url automatically. Try the example I gave you

bunny1
03-24-2007, 03:23 AM
great i didnt realise that
thank you!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum