Мой PHP код для регистрации пользователя не работает
html-код usersignup.html (файл должен быть php?)
<div id="Sign-Up" align=center> <fieldset style="width:30%"> <legend>Registration Form</legend> <table border="0"> <tr> <form method="POST" action="signup.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="username"></td> </tr> <tr> <td>Password</td><td> <input type="password" name="password"></td> </tr> <tr> <td>Confirm Password </td><td><input type="password" name="passwordcf"></td> </tr> <tr> <td><input id="button" type="submit" name="submit" value="Sign-Up"></td><td></form><a href="/lopology/userarea.html">User Area</a></td> </tr> </table> </fieldset> </div>
singup.php
<?php define('DB_HOST', 'kileva.com:3307'); define('DB_NAME', 'kilevaforms'); define('DB_USER','kwiknotes'); define('DB_PASSWORD','H{fAVAQ6w,KQ'); $con=mysql_connect(DB_HOST,DB_USER,DB_PASSWORD) or die("Failed to connect to MySQL: " . mysql_error()); $db=mysql_select_db(DB_NAME,$con) or die("Failed to connect to MySQL: " . mysql_error()); function NewUser() { $fullname = $_POST['name']; $userName = $_POST['username']; $email = $_POST['email']; $password = $_POST['password']; $query = "INSERT INTO user1 (fullname,userName,email,password) 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['username'])) //checking the 'user' name which is from Sign-Up.html, is it empty or have some text { $query = mysql_query("SELECT * FROM user1 WHERE userName = '$_POST[username]' AND pass = '$_POST[password]'") or die(mysql_error()); if(!$row = mysql_fetch_array($query) or die(mysql_error())) { newuser(); ; } else { echo "SORRY...YOU ARE ALREADY REGISTERED USER..."; } } } if(isset($_POST['submit'])) { SignUp(); } ?>
Что я уже пробовал:
Я проверил правильность полей БД и правильность имени хоста, имени БД и имени пользователя, пароля