我添加了动作值注册文件
<body>
<div id="registration">
<h2><b><i>Electronic Montessori Learning</i><b></h2>
<form id="RegisterUserForm" action="connect.php" method="post">
<fieldset>
<p>
<label for="name">Name</label>
<input id="name" name="name" type="text" class="text" value="" />
</p>
<p>
<label for="password">Password</label>
<input id="password" name="password" class="text" type="password" />
</p>
<p>
<button id="registerNew" name="registerNew" type="submit">Register</button>
</p>
</fieldset>
</form>
</div>
<body>
我没有发布所有registration.html代码,因为它工作正常
连接.php
<?php
$db=mysql_connect("localhost", "root", "") or die(mysql_error());
echo "Connected to MySQL<br />";
mysql_select_db("users") or die(mysql_error());
echo "Connected to Database";
$name ='';
$password ='';
if(isset($_POST['registerNew'])){
// Storing form values into PHP variables
$name = $_POST['name']; // Since method=”post” in the form
$password = $_POST['password'];
}
mysql_query("INSERT INTO user_eml(Name, Password) VALUES('$name', '$password' ) ")
or die(mysql_error());
echo "Data Inserted!";
echo 'Thank you for submitting your details!';
?>
但它仍然无法正常工作,当我按下注册按钮时,它显示了 connect.php 的 php 代码