gpt4 book ai didi

php - 复选框值操作

转载 作者:行者123 更新时间:2023-11-29 14:30:18 25 4
gpt4 key购买 nike

下面是我的静态复选框及其值。

我需要的是,当用户选中任何复选框,然后单击提交时,我需要在 php 中进一步检查检查 kboxes 值,我想将它们放入 mysql 查询中,如下所示

select * from table where "all check boxes values"

我在 mysql 中的搜索将基于所有检查的值

echo "<table border='0'>";
echo "<p>Make a Selection to view details</p>";
echo "<tr><th>Scheme Type</th><th>Scehme Sector</th><th>Area</th><th>Year</th></tr>";
echo "<tr><td><input type='checkbox' name='chkSkills' value='ADP' /> District ADP <br/>";
echo "<input type='checkbox' name='chkSkills' value='cmd'/> CM Directives <br/>";
echo "<input type='checkbox' name='chkSkills' value='tkpp'/> Tameer KPK Program <br/>";
echo "<input type='checkbox' name='chkSkills' value='tbcess' /> Tobacco Cess</td>";
echo "<td><input type='checkbox' name='chkSkills' value='wss' /> Water Supply & Sanitation <br/>";
echo "<input type='checkbox' name='chkSkills' value='road'/> Roads <br/>";
echo "<input type='checkbox' name='chkSkills' value='ccb'/> CCB <br/>";
echo "<input type='checkbox' name='chkSkills' value='health'/> Health <br/>";
echo "<input type='checkbox' name='chkSkills' value='education'/> Education <br/>";
echo "<input type='checkbox' name='chkSkills' value='others' /> Others</td>";
echo "<td><input type='checkbox' name='chkSkills' value='pk77'/> PK-77 <br/>";
echo "<input type='checkbox' name='chkSkills' value='pk78'/> PK-78 <br/>";
echo "<input type='checkbox' name='chkSkills' value='pk79' /> PK-79 </td>";
echo "<td><input type='checkbox' name='chkSkills' value='1112'/> 2011-12 <br/>";
echo "<input type='checkbox' name='chkSkills' value='1011'/> 2010-11 </td></tr>";
echo "<tr><td colspan='4' align='right' style='background-color:white;'><input type='submit' name='devsub' value='Submit' /></td></tr>";
echo "</table>";

问候

最佳答案

更改每个复选框的name = chkSkills[]并通过 $_POST['chkSkills']

检索

不仅仅是这样做

foreach($_POST['chkSkills'] as $key => $value){
MYSQL_QUERY
}

关于php - 复选框值操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10136027/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com