How Can I Get Radio Button Values On Next Page ?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
saqib389
Forum Commoner
Posts: 44
Joined: Wed Nov 30, 2005 2:13 am

How Can I Get Radio Button Values On Next Page ?

Post 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
foobar
Forum Regular
Posts: 613
Joined: Wed Sep 28, 2005 10:08 am

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

Post 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:
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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
Post Reply