单选按钮不包含在帖子中

时间:2014-12-19 13:15:51

标签: php html netbeans

我正在制作一个将值发布到php文件的注册表单,但是在检查netbeans中的post变量时,我看到单选按钮没有包含在数组中,但所有其他输入都是。

下面是代码:

<form id="register" action="php/register.php" method="post">
  <h1>Please fill out as much as possible</h1>
  <h2>Would you like to register as a bulk buyer or a retail buyer?</h2>
  <div id="container">
    <div class="regForm left">
      <input type="radio" name="custType" value="Bulk"><label>Bulk buyer</label><br>
      <input id="bEmail" type="email" name="bEmail"><label>Email address</label><br>
      <input id="bPass" type="password" name="bPass"><label>Password</label><br>
      <input id="bComp" type="text" name="bCompany"><label>Company name</label><br>
      <input id="bContact" type="text" name="bContact"><label>Contact person</label><br>
      <input id="bOffice" type="tel" name="bOffice"><label>Office number</label><br>
      <input id="bMobile" type="tel" name="bMobile"><label>Mobile number</label><br>
      <input id="bVAT" type="text" name="bVat"><label>VAT number</label><br>
      <textarea id="bAddress" cols="17" rows="4"></textarea><label>Address</label>
    </div>
    <div class="regForm right">
      <input type="radio" name="custType" value="Retail"><label>Retail buyer</label><br>
      <input id="rEmail" type="email" name="rEmail"><label>Email address</label><br>
      <input id="rPass" type="password" name="rPass"><label>Password</label><br>
      <input id="rMobile" type="tel" name="rMobile"><label>Mobile number</label>
    </div>
    <div class="regForm right">
      <label>Do you wish to receive additional email marketing from us? <input id="marketingCheck" type="checkbox" name="market"></label><br>
      <input id="regSubmit" type="submit" name="submit" value="Register"><a href="" id="cancelReg">Cancel</a>
    </div>
    <div class="clear"></div>
  </div>
</form>

目前我对php文件中的帖子一无所知。

我可以在netbeans中发布post var的截图,但该网站不允许我这样做。 继承人print_r($_POST);的结果 Array ( [bEmail] => [bPass] => [bCompany] => [bContact] => [bOffice] => [bMobile] => [bVat] => [rEmail] => [rPass] => [rMobile] => [submit] => Register )

我查看了另一篇文章,但他们似乎只是在代码中打字错误。

由于

2 个答案:

答案 0 :(得分:0)

试试这个:

确保您已经检查过#34;提交前的单选按钮?只有检查按钮才能在请求中看到

 <input type="radio" name="custType" value="Bulk" selected>

答案 1 :(得分:0)

仅当选择了任何选项时,单选按钮的值才会保存在$ _POST中,因此您只能通过POST检查该无线电盒值(