我必须将表单中的数据上传到sql数据库。我尝试了这段代码,但它不起作用。你知道错误在哪里吗?
<!DOCTYPE html>
<?php
if(isset($_POST['submitt'])){
$val = $_POST['0001'];
$con=mysql_connect("localhost","username","password");
mysql_select_db("my_database",$con);
$sql="INSERT INTO 0001 (col1, col2, col3) VALUES ('$val', 'c', 'c')";
$dbcn=mysql_query($sql,$con);
}
?>
<html>
<body>
<form action="" method="post">
<input type="text" name="0001" id="0001"/>
<br>
<input type="submit" value="invia"name='submitt' id="submitt"/>
</form>
</body>
</html>