【发布时间】:2012-12-19 08:47:26
【问题描述】:
有谁知道为什么选中的复选框的值没有被回显?
Javascript 代码:
<script src="jquery.min.js" type="text/javascript"></script>
<script src="jquery.js" type="text/javascript"></script>
<script src="jquery.form.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
<!--
// wait for the DOM to be loaded
$(document).ready(function()
{
// bind 'vgsForm' and provide a simple callback function
$('#vgsForm').ajaxForm(function()
{
$('#Suggestion').load('process_answers.php');
});
});
HTML 表单
<div id="Questions">
<form id="vgsForm" action="process_answers.php" method="get" >
<div id="Q1">
<label><input type="radio" name="q1option" value="Less than 16" />Less than 16</label><br />
<label><input type="radio" name="q1option" value="16 or more" />16 or more</label>
</div>
process_answers.php
echo('$_GET: '.print_r($_GET, true));
//Get Question 1
if (isset($_GET['q1option']))
{
$q1option = $_GET['q1option'];
}
else
{
$q1option = NULL;
}
echo("Selected: ".$q1option);
这是回应:
$_GET: 数组 ( ) 已选择:
感谢任何帮助
丹尼尔
附:这是我得到 JavaScript 代码的地方http://malsup.com/jquery/form/
是否需要任何额外的 JavaScript 代码才能使其工作?
【问题讨论】:
标签: jquery html ajax forms radio-button