<tr>
<td valign="top">
<label for="rb_cpf_field6_1">
Seller: I would like to list my equipment
</label>
<input type="radio" name="userfield[field6]" value="1" id="rb_cpf_field6_1" checked="checked" />
</td>
</tr>
<tr>
<td valign="top">
<label for="rb_cpf_field6_2">
Buyer: I'd like to inquire about a listing
</label>
<input type="radio" name="userfield[field6]" value="2" id="rb_cpf_field6_2" />
</td>
</tr>
<tr>
<td valign="top">
<label for="rb_cpf_field6_3">
Both: I'm interested in buying and selling
</label>
<input type="radio" name="userfield[field6]" value="3" id="rb_cpf_field6_3" />
</td>
</tr>
<tr>
<td valign="top">
<label for="rb_cpf_field6_4">
Other: I'm here for another purpose
</label>
<input type="radio" name="userfield[field6]" value="4" id="rb_cpf_field6_4" />
</td>
</tr>
我需要能够从这些单选按钮选项中获取帖子信息(在PHP中),所以我可以这样做:
if(is_a_buyer){ 做这个 } else { 做点别的 }
非常感谢任何帮助!
答案 0 :(得分:0)
答案 1 :(得分:0)
<form name="something" action="check.php" method="POST">
<tr>
<td valign="top">
<label for="rb_cpf_field6_1">
Seller: I would like to list my equipment
</label>
<input type="radio" name="userfield[field6]" value="1" id="rb_cpf_field6_1" checked="checked" />
</td>
</tr><tr>
<td valign="top">
<label for="rb_cpf_field6_2">
Buyer: I'd like to inquire about a listing
</label>
<input type="radio" name="userfield[field6]" value="2" id="rb_cpf_field6_2" />
</td>
</tr><tr>
<td valign="top">
<label for="rb_cpf_field6_3">
Both: I'm interested in buying and selling
</label>
<input type="radio" name="userfield[field6]" value="3" id="rb_cpf_field6_3" />
</td>
</tr><tr>
<td valign="top">
<label for="rb_cpf_field6_4">
Other: I'm here for another purpose
</label>
<input type="radio" name="userfield[field6]" value="4" id="rb_cpf_field6_4" />
</td>
</tr>
</form>
这是你的主要代码(我添加了表单标签,认为它已经不存在。如果有,请删除它们。)
现在,在check.php
页面上,请使用:
if ($_POST['userfield[field6]'] == 2 || $_POST['userfield[field6]'] == 3) {
do this;
}
else {
do something else;
}
答案 2 :(得分:0)
if (isset($_POST['insertRadioButtonName']) == radioButtonValue || isset($_POST['insertOtherRadioButtonName']) == otherRadioButtonValue) {
echo 'idk';
} else {
echo 'something';
}