我是 PHP 新手,只是想创建一个非常基本的注册表单,但是当我单击提交时,它不会在我的数据库中创建数据。
<form action"signup.php" method="post">
username:<input type="text" name="n"><br />
password:<input type="password" name="p"><br />
id :<input type="text" name="id"><br />
<input type="submit">
</form>
<?php
$conn = mysql_connect("localhost", "root", "");
$db = mysql_select_db("myth", $conn);
?>
<?php
$user = $_POST['n'];
$pass = $_POST['p'];
$id = $_POST['id'];
$sql = "INSERT into phplogin values(" . $id . ",'" . $user . "','" . $pass . "')";
$query = mysql_query();
if(!$query)
echo "failed ".mysql_error();
else
echo "successful";
?>