How Can I Get Radio Button Values On Next Page ?

saqib389saqib389 BeginnerLink Clerk
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
<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
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

Comments

  • FelixFelix Junior Member Shared Hoster
    Simply add the value attribute to the input tag like so.

    [HTML]
    <input type="radio" value="qty" name="qty">
    [/HTML]

    ;)
  • PythonPython Forum Leader The Royal RAM
    You would need one for each of the values but keep them with the same name. Like this:

    [HTML]<input type="radio" value="1" name="qty">
    <input type="radio" value="2" name="qty">
    <input type="radio" value="3" name="qty">
    <input type="radio" value="4" name="qty">[/HTML]

    Then when the form is submitted you can access the selected buttons value with $_POST[qty] because qty is the name of them.

    The Royal Ram

  • saqib389saqib389 Beginner Link Clerk
    i was asking some thing else......
    i want to display radio button value on next page when user sumbit the page.. tats wat i m asking
  • PythonPython Forum Leader The Royal RAM
    Then you could do...
    echo $_POST[qty];
    

    That would display the value of the selected radio button... That what you want?

    You could also do conditional statements then for example...
    if($_POST[qty] = 1)
    {
    echo "Value is 1";
    }
    

    The Royal Ram

  • saqib389saqib389 Beginner Link Clerk
    tnx mate i got it... actually i m too new in php...
Sign In or Register to comment.