我有一个搜索本地数据库的表单。它仍处于生产阶段。但是,当我尝试获取单选按钮的值时,什么也没有。下面是代码:
PHP
$k = $_GET['k'];
$terms = explode(" ", $k);
$query = "SELECT * FROM series8000 WHERE ";
$vision = $_GET['Vision'];
$new = $_GET['new1'];
$sithelo = sithelo;
foreach ($terms as $each) {
$i++;
if ($i == 1)
$query .= "Description LIKE '%$each%' ";
else
$query .= "OR Description LIKE '%$each%' ";
}
$query .= "AND VisionType = '$vision' ";
if (!empty($new1 )) {
$query .= "AND Change = '$new1' ";
}
HTML
<form action='index.php' method='get'>
<fieldset>
<legend>Change</legend>
<label for="New" class="property">New Product</label>
<div class="labels">
<input type="radio" name="new1" <?php if (isset($new1) && $new1 == "N") echo "checked=yes"; ?>size="30" value="N"/>
<input type="radio" name="new1" size="30" value="Y"/>
<input type="radio" name="new1" size="30" value="YN"/>
</div>
<div style="clear: both;"></div>
挑战是当我在此处未显示的 php 代码中回显时,名为 new1 的单选按钮的值变为空白。我必须获取单选按钮的值,以便我可以在查询中使用它。