0

I am trying to post data to a webpage I have (page3.php). However, when I do $test=$_POST['radio_second']; on this page, there is no data in the test variable.

Can anyone figure it out? Many thanks.

<p>
    <form method="post">
        <label for="radio1_0">1</label>
        <input type="radio" name="radio_second" id="radio1_0" value="1" />

        <label for="radio1_1">2</label>
        <input type="radio" name="radio_second" id="radio1_1" value="2" />

        <label for="radio1_2">3</label>
        <input type="radio" name="radio_second" id="radio1_2" value="3" checked/>

        <label for="radio1_3">4</label>
        <input type="radio" name="radio_second" id="radio1_3" value="4" />

        <label for="radio1_4">5</label>
        <input type="radio" name="radio_second" id="radio1_4" value="5" />
    </p>
</form>
</fieldset>
</div>
</div>
<a href="page1.php"  data-inline="true" data-theme="a"  data-role="button" data-direction="reverse" data-transition="slide" style="height:53px;width:150px">Prev</a>
<a href="page3.php"  data-inline="true" data-theme="a"  data-role="button" data-transition="slide" style="height:53px;width:150px">Next</a>
jwheron
  • 2,553
  • 2
  • 30
  • 40
SooIn Nam
  • 3,121
  • 4
  • 21
  • 18
  • This markup is incomplete. Where are the extraneous `fieldset`, `div`, and anchor tags coming from? Please edit the rest of your markup into this question so that anyone who comes through here later can benefit from this question. – jwheron Nov 15 '11 at 15:46

1 Answers1

4

That's because you are not submiting your FORM to page3.php. A element in form is just opening page3.php without submiting form to it. You need to replace that A element with <input type="submit" value="Next"> and place it before </form>, and add attribute action="page3.php" to FORM element. Alternatively you could use Javascript to trigger form submit when user clicks on link.

 <p>
      <form method="post" action="post3.php">
        <label for="radio1_0">1</label>
         <input type="radio" name="radio_second" id="radio1_0" value="1" />
        <label for="radio1_1">2</label>
        <input type="radio" name="radio_second" id="radio1_1" value="2" />
     <label for="radio1_2">3</label>
         <input type="radio" name="radio_second" id="radio1_2" value="3" checked/>
        <label for="radio1_3">4</label>
        <input type="radio" name="radio_second" id="radio1_3" value="4" />
     <label for="radio1_4">5</label>
         <input type="radio" name="radio_second" id="radio1_4" value="5" />

     <a href="page1.php"  data-inline="true" data-theme="a"  data-role="button" data-direction="reverse" data-transition="slide" style="height:53px;width:150px">Prev</a>
     <input type="submit"  data-inline="true" data-theme="a"  data-role="button" data-transition="slide" style="height:53px;width:150px" value="Next" />

    </form>
   </p>
Māris Kiseļovs
  • 16,957
  • 5
  • 41
  • 48