我在后台和文件管理/禁令,国家ip.php隐藏价值
内容 这里的复选框可在管理后台抵达该国名单与复选框
<?php
$countryiso = mysql_query("SELECT distinct country_name as country_name FROM location_country");
echo '<table>';
echo '<th>Country</th><th> Add/Remove </th>';
while ($row = mysql_fetch_assoc($countryiso)) {
echo '<tr>';
echo '<td>'. $row['country_name'] . '</td>';
echo '<td><input type="checkbox"></td>';
echo '</tr>';
}
echo '</table>';
?>
并在叶端注册它ECHO的他们在registration.php。
$ctrstr="";
$res=mysql_query("select * from location_country where code NOT IN('A1','A2','AP','EU') order by name");
$ctrstr.="<select name=\"country\" id=\"country\" onChange=\"loadState();\" >
<option value=\"\" selected=\"selected\">-Select Country-</option>";
while($row=mysql_fetch_row($res))
{
if($country==$row[0])
$ctrstr.="<option value=\"$row[0]\" selected>$row[1]</option>";
else
$ctrstr.="<option value=\"$row[0]\">$row[1]</option>";
}
$ctrstr.="</select>";
我想知道如何使用复选框隐藏选择列表中的值。当我在后端取消一个国家的检查时,它也应该在选择字段的前端被删除。如果我再检查一次,应该再次显示。我想提到的是,这些国家在一个专栏中存放在MySQL中。
MYSQL - 表结构
# Name Type Collation Attributes Null Default Extra
1 code varchar(2) utf8_unicode_ci No
2 name varchar(255) utf8_unicode_ci No
当您从后端删除任何国家时,保存已删除国家/地区列表?显示逻辑如何在后端保存已删除或添加的国家/地区列表 –
我正在考虑以某种方式添加另一列,并在列中为已检查国家/地区的值为1,未检查的国家/地区的值为0。但有很多事情要做,我找不到,也不知道:在这种情况下,我将需要更新从MySQL的价值,当我检查和取消检查,并在添加某种方式后,如果条件如:如果价值所选国家为0,然后从前端的选择字段中隐藏国家。对不起,我在这里有点小菜。 – Adrian
是的,你可以做到这一点的简单刚刚保存的国家与从后端和前端检查1只询问他们像'SELECT * FROM location_country其中代码NOT IN(“A1”,“A2”,“AP” ,“EU”)和your_new_column = 1个ORDER BY name'这就是所有前端只有你必须建立更新/与your_new_column –