单选按钮表单不发送数据。什么是正确的语法?

时间:2012-05-05 23:46:22

标签: php html forms radio

这个单选按钮表单的正确语法是什么,我正在POSTING。没有单选按钮,表单工作正常,只有当我添加它时,我才会收到错误说明,未定义的变量:where_to_search

<form action="" method="POST" >

<div class="control-group">
    <label class="control-label">Search By:</label>
        <div class="controls">
            <label class="radio">
                <input type="radio" name="where_to_search" id="optionsRadios1" value="1" checked>
                     Group Name
            </label>
                <label class="radio">
            <input type="radio" name="where_to_search" id="optionsRadios2" value="2">
                     Group Description
                </label>
            </div>
     </div>   


<input class="span2" name="keywords" id="appendedPrependedInput" size="15" placeholder="Search groups.." type="text"/><button class="btn" value="Go" type="submit">Go!</button>




</form>

2 个答案:

答案 0 :(得分:1)

尝试:checked =“checked”和&lt; input type =“submit”

答案 1 :(得分:0)

您需要使用$ _POST参考变量:

$_POST['where_to_search']