请帮助,这让我很生气!我想,我有一个简单的注册表单,我试图用PHP将数据发送到Webmatrix中的MySQL。 (PHP 5.5将数据添加到webmatrix 3中的MySQL 5.7)但是,我在Chrome中收到以下错误:
localhost页面无效 localhost目前无法处理此请求。 500
这是PHP:
<?php
$db_user = 'root';
$db_pass = '';
$db_name = 'MySQL10';
$db_host = 'localhost';
$fname = $_POST('fname')
$lname = $_POST('lname')
$email = $_POST('email')
//Create Connection
$conn = new mysqli ( $db_host, $db_user, $db_pass, $db_name);
//Check connection
if ($conn->connect_error) {
die("Connection failed:" . $conn->connect_error);
}
$sql = "INSERT INTO table_1 (fname_1, lname_1, email_1)
VALUES ('$fname', '$lname', '$email')";
$conn->close();
?>
这里标记:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Test Page</title>
</head>
<body>
<div class="registration">
<form name="test" method="post" action="demo.php" autocomplete="on">
<p>First name:<input type="text" name="fname" value=""></p>
<p>Last name:<input type="text" name="lname" value=""></p>
<p>Email Address:<input type="email" name="email" value=""></p>
<input type="submit" value="Submit">
</form>
</div>
</body>
</html>
答案 0 :(得分:0)