![](/img/trans.png)
[英]Checking a checkbox if its value can be found in the database using codeigniter
[英]How can i check the value in checkbox if its in database using php
我正在尝试检查该复选框是否将值保存在数据库中,但我一点也不知道。
首先,我的复选框是关于尺寸的。 小型,小型,中型等
这是我的代码,显示我的尺寸和复选框
$statement = $db->prepare("SELECT * FROM sizestops order by sizestopsID ASC");
$statement->execute();
while($rows = $statement->fetch(PDO::FETCH_ASSOC)) {
$sizetopsCode = $row['sizetopsCode'];
echo "
<label style='display: inline-block;
font-size: 100%;
font-family: Arial;
width: 100px;'>
<input type='checkbox' name='sizes[]' class='checkbox' id='sizesprod' onchange='checksize()' value='" .$rows['sizestopsID']. "'>" . $rows['sizetopsName'] ."</label>
";
}
如何检查尺寸值? 请帮我T_T
<?
$statement = $db->prepare("SELECT * FROM sizestops ORDER BY sizestopsID ASC");
$statement->execute();
while($rows = $statement->fetch(PDO::FETCH_ASSOC))
{
$sizetopsCode = $rows['sizetopsCode'];
$sizetopsID=$rows['sizestopsID'];
$sizetopsName=$rows['sizetopsName'];
?>
<label style='display: inline-block;font-size: 100%;font-family: Arial;width: 100px;'>
<input type='checkbox' name='sizes[]' class='checkbox' id='sizesprod' onchange='checksize()' value="<? echo $sizetopsID;?>"><? echo $sizetopsName;?>
</label>
<?}?>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.