所以我在php中创建了一个注册页面,我得到了这个。 解析错误:语法错误,第36行/Applications/XAMPP/xamppfiles/htdocs/signup.php中的文件意外结束。
这是完整的代码。
<?php
define('DB_HOST', 'localhost');
define('DB_NAME', 'Users');
define('DB_USER', 'root');
define('DB_PASSWORD', '');
$con = mysql_connect('localhost','root','') or die("Failed to connect to MySQL: " . mysql_error());
$db = mysql_select_db('Users',$con) or die("Failed to connect to MySQL: " . mysql_error());
function NewUser() {
$fullname = $_POST['name'];
$userName = $_POST['user'];
$email = $_POST['email'];
$password = $_POST['pass'];
$query = "INSERT INTO Users (fullname,userName,email,pass) VALUES ('$fullname','$userName','$email','$password')";
$data = mysql_query($query) or die(mysql_error());
if($data) {
echo "YOUR REGISTRATION IS COMPLETED...";
}
}
function SignUp() {
if(!empty($_POST['user']))
?>
<!DOCTYPE HTML> <html>
<head>
<title>Sign-Up</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body id="body-color">
<div id="Sign-Up">
<fieldset style="width:30%">
<legend>Registration Form</legend>
<table border="0"> <tr>
<form method="POST" action="connectivity-sign-up.php">
<td>Name</td><td> <input type="text" name="name"></td>
</tr> <tr> <td>Email</td><td> <input type="text" name="email"></td>
</tr> <tr> <td>UserName</td><td> <input type="text" name="user"></td>
</tr> <tr> <td>Password</td><td> <input type="password" name="pass">
</td> </tr>
<tr> <td>Confirm Password </td>
<td><input type="password" name="cpass"></td> </tr>
<tr> <td><input id="button" type="submit" name="submit" value="Sign-Up"></td>
</tr> </form> </table> </fieldset> </div>
</body>
</html>
非常感谢任何帮助。