dounouxi1020 2014-12-19 13:15
浏览 24
已采纳

单选按钮不包含在帖子中[关闭]

I am making a registration form that posts the values to a php file, but upon inspection of the post variable in netbeans, I saw that the radio button is not included in the array yet all the other input are.

Heres the code:

<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>

At the moment I am doing nothing with the post in the php file.

I could post a screenshot of the post var in netbeans, but the site will not allow me. Heres the result of print_r($_POST); Array ( [bEmail] => [bPass] => [bCompany] => [bContact] => [bOffice] => [bMobile] => [bVat] => [rEmail] => [rPass] => [rMobile] => [submit] => Register )

I looked at the other post, but they seem to have just a typo in the code or the sort.

Thanks

  • 写回答

2条回答 默认 最新

  • ds3422222222 2014-12-19 13:25
    关注

    Try this:

    Be sure you have "checked" the radio button before submit? only checked buttons will be seen in request

    or

     <input type="radio" name="custType" value="Bulk" selected>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
  • ¥15 相敏解调 matlab
  • ¥15 求lingo代码和思路
  • ¥15 公交车和无人机协同运输
  • ¥15 stm32代码移植没反应