我正在製作一個註冊表單,將值發佈到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)
結果我看了看其他職位,但他們似乎只是在代碼或排序一個錯字。
感謝
是否在提交之前「檢查」單選按鈕?只有選中的按鈕纔會在請求中出現(與複選框相同) – donald123
參考上面的回答:您可以使用「selected」屬性默認選擇一個單選按鈕 – newBee
您是否選擇了單選按鈕? –