Page 1 of 1

How Can I Get Radio Button Values On Next Page ?

Posted: Mon Dec 05, 2005 2:53 pm
by saqib389
Guyz can u tell me that how can i get radio button values on next page ? i want to dipsplay that if user click on first radio button.... then on next page there would b display that value of radio button..... if user choose another.. then that value display.. which user selected from radio button.........

here is the code. to more clearify my question

Page1.php

Code: Select all

<form method=post action="info.php">
<b>:: Shirt Information :: </b><Br><br>
Color<br><input type=text name=color><Br>
Size<br><input type=text name=size><Br>
<Br>
Quantity<br>
1<input type=radio name=qty>
2<input type=radio name=qty2>
3<input type=radio name=qty3>
4<input type=radio name=qty4>
<Br><br>
<input type=submit value=sumbit>
</form>
Now here i want to display all values which has been selected on page1.php


info.php

Code: Select all

echo "Color: ".$_POST['color']."<br>";
echo "Size: ".$_POST['size']."<br>";
now the question is how can i call radio button values which i have selected on page1.php..... please help me out... and tell me how can i do this ?
waitnig for hopefull reseponse
SaQib

Re: How Can I Get Radio Button Values On Next Page ?

Posted: Mon Dec 05, 2005 3:01 pm
by foobar
Try this:

Code: Select all

<form method="post" action="info.php" name="shirtform">
<b>:: Shirt Information :: </b><br /><br />
Color<br /><input type="text" name="color" value="" /><br />
Size<br /><input type="text" name="size" value="" /><br />
<Br>
Quantity<br>
1<input type="radio" name="qty" value="1" />
2<input type="radio" name="qty" value="2" />
3<input type="radio" name="qty" value="3" />
4<input type="radio" name="qty value="4" />
<br /><br />
<input type="submit" value="sumbit" />
</form>

Code: Select all

echo "Color: ".$_POST['color']."<br>";
echo "Size: ".$_POST['size']."<br>";
echo "Quantity: ".$_POST['qty'];
//echo "Quantity: {$_POST['qty']}"; //Same as above, but slightly different syntax. The result is the same.
[edit] So you don't get confused, I cleaned up your HTML somewhat. :wink:

Posted: Mon Dec 05, 2005 3:02 pm
by Chris Corbyn
Radio buttons are multiple... they should *all* have the same name with different values....

Code: Select all

Quantity<br>
1<input type="radio" name="qty" value="1" />
2<input type="radio" name="qty" value="2" />
3<input type="radio" name="qty" value="3" />
4<input type="radio" name="qty" value="4" />
You access them via $_POST['qty'] like you were doing....

EDIT | Meh... I'm too slow :P