我有一个简单的 php 联系表,但无法让单选按钮仅选择 1 个选项(需要选择)。也不确定下拉框所需的脚本(不需要此选择)
//radio button individual or team required
if(trim($_POST['individual']) == '') {
$hasError = true;
} else {
$individual = trim($_POST['individual']);
}
//radio button individual or team required
if(trim($_POST['team']) == '') {
$hasError = true;
} else {
$team = trim($_POST['team']);
}
<input type="radio" name="individual" value="individual" id="individual" checked="checked">Individual</label>
<input type="radio" name="team" value="team" id="team" > Team</label>
<label for="shirt"> <strong>T-Shirt size (Optional)</strong></label>
<br />
<select name="Shirt Sizes" id="shirt">
<option value="small" name="small" id="small">Small</option>
<option value="medium" name="medium" id="medium" selected="selected">Medium</option>
<option value="large" name="large" id="large">Large</option>
<option value="xlarge" name="xlarge" id="xlarge">Extra Large</option>
</select>
任何帮助都会很棒。干杯