我正在尝试将数据发布到我拥有的网页(page3.php)。但是,当我在此页面上$test=$_POST['radio_second'];
时,测试变量中没有数据。
任何人都可以搞清楚吗?非常感谢。
<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>
答案 0 :(得分:4)
那是因为您没有将您的FORM提交给page3.php。表单中的元素只是打开page3.php而不向其提交表单。您需要用&lt; input type =“submit”value =“Next”&gt;替换该A元素。并将其放在&lt; / form&gt;之前,并将属性action =“page3.php”添加到FORM元素。或者,当用户点击链接时,您可以使用Javascript触发表单提交。
<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>