My university left a task to create a login system with PHP (obviously, connected to a database ). The problem is that my registration page does not save any data sent to the database. I don't know why this is.
Here is my code:
<html>
<head>
<link type="css/text" rel="StyleSheet" href="UniXYZ.css"/>
<meta charset="UTF-8"/>
<title>Registro</title>
</head>
<body>
<?php
session_start();
$host="****";
$username="****";
$password="****";
$db_name="****";
$tbl_name="****";
mysqli_connect($host,$username,$password,$db_name)or die("cannot connect");
$email=$_POST['email'];
$password=$_POST['password'];
if (filter_var($email, FILTER_VALIDATE_EMAIL)){
$sql="select 'Email' from 'USER' where 'Email'='$email'";
$result=mysqli_query($sql);
$count=mysqli_num_rows($result);
if($count>0){
echo ("<center><h1><font color='red'>El usuario<br><font color='blue'>".$email."<br><font color='red'>ya existe!<br><a href='index.php'>Inicio</a>");
}else{
$sql="INSERT INTO $tbl_name ('Email','PASS')VALUES('$email','$password')";
$result=mysqli_query($sql);
if($result){
header("location:InicioXYZ.php");
}else{
echo "ERROR MySql";
}
mysqli_close();
}
}else{
echo"<center><h1><font color='red'>Error el mail ingresado no es válido<br><a href='index.php'>Inicio</a>";
}
?>
<img width="1300px" src="http://i.imgur.com/iOfMyLK.png"/>
<hr width="80%"/>
<div class="login">
<h3 class="h3">Datos Procesados</h3>
<div class="imglog"><img src="http://i.imgur.com/YcUAZHH.png"/></div><br><br><br><br>
<h4><a href="InicioXYZ.php" class="registrate">Pulsa aquí para regresar a la pagina de inicio.</a></h3>
</div>
</body>
</html>