您好,我有一个 Html 表单向我的数据库发送 0 而不是 1 的问题,它被设置为 tinyint 1 我已经搞砸了好几天了。
我使用 phpmyadmin xampp 服务器 html php
<!--THIS IS SKILLS-->
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
if (!isset($_POST['action']))
mysql_select_db("client", $con);
$sql="INSERT INTO skills (driving_licence,HGV,engineer,carpenter,chef,PSV)
VALUES
('$_POST[driving_licence]','$_POST[HGV]','$_POST[engineer]','$_POST[carpenter]','$_POST[chef]','$_POST[PSV]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "skills have been added";
mysql_close($con);
?>
表格代码是
<center><form method="post" action="skills.php">
<table cellspacing="50">
<tr>
<center><h1>Record Client Skills</h1></center>
<center><p> Please choose the relevent boxes</p></center>
<center><input type="checkbox" name="driving_licence" value="driving_licence">I have a Full UK Driving Licence<br>
<input type="checkbox" name="hdv" value="hgv">I hold a valid a HGV licence<br>
<input type="checkbox" name="engineer" value="engineer">I have an Engineering qualification <br>
<input type="checkbox" name="carpenter" value="carpenter">I have a Carpentry qualification <br>
<input type="checkbox" name="chef" value="chef">I have Catering qualification<br>
<input type="checkbox" name="psv licence" value="psv">I have a valid PSV licence<br>
</tr>
</table>
<input type="reset" value="Reset Form"/> <input type="submit" value="Send" />
</center>
任何人都可以帮忙吗?
抢