我一直在尝试设置我的代码,这样一旦你点击一个按钮它就会更新我的数据库中的一个字段,但是它似乎没有做任何事情,我对php很新,任何帮助都会非常感谢。
(某些连接信息,如$ username已更改为更通用的格式)。
<?php
$username = "username";
$password = "password";
$host = "localhost";
$db = $username;
$connection = connect($host, $username, $password, $db);
if(isset($_POST["PSol"]))
{
$sql = "UPDATE MK1 SET Sol='Progress' WHERE id = 1";
if (mysqli_query($connection, $sql)) {
echo "success";
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($connection);
}
mysqli_close($connection);
echo "<p>Disconnected from server: ".$host."</p>";
}
?>
<form action = "" method = "POST" name = "PSolCanvas" class = "PSolCanvas">
<input name = "PSol" type = "button" class = "PSol" value = "P"/>
</form>