我尝试使用Select Option传递数据,而不是要求用户手动输入。但是,我无法让它传递价值。我有一个错误消息,指出缺少的值是一个预定义的消息:
Please Enter The Issuing State for your Drivers License
。
不确定我哪里出错了。如果有人愿意指出我正确的方向。
PHP
if (empty($_POST['driverslicensestate'])) { $error[] = 'Please Enter The Issuing State for your Drivers License ';}
else { $driverslicensestate = $_POST['driverslicensestate']; }
HTML
<div class="elements">
<select id="driverslicensestate" name"driverslicensestate">
<option selected value="-1">Select Drivers License State</option>
<option id="driverslicensestate" name="driverslicensestate" value="AL">Alabama</option>
<option id="driverslicensestate" name="driverslicensestate" value="AK">Alaska</option>
<option id="driverslicensestate" name="driverslicensestate" value="AZ">Arizona</option>
<option id="driverslicensestate" name="driverslicensestate" value="AR">Arkansas</option>
<option id="driverslicensestate" name="driverslicensestate" value="CA">California</option>
<option id="driverslicensestate" name="driverslicensestate" value="CO">Colorado</option>
<option id="driverslicensestate" name="driverslicensestate" value="CT">Connecticut</option>
<option id="driverslicensestate" name="driverslicensestate" value="DE">Delaware</option>
...
</select>
</div>
使用 只使用文本字段时工作得很好。
<input type="text" placeholder="Drivers License #" id="driverslicense" name="driverslicense" size="25" />
答案 0 :(得分:1)
等于!
[self managedObjectContext]
为什么要为选项添加name属性?我想,只是价值就足够了!
答案 1 :(得分:1)
添加'='以选择
<select id="driverslicensestate" name="driverslicensestate">