im trying to create a website for a project in school. The first step supposed to be simple - register & login pages. The php code have never worked... (sometimes due to problems in the code and most of the times the result was blank page).
html code:
<!doctype html>
<html>
<title>Tracycle Registration</title>
<link rel="stylesheet" href="test.css">
<div id="header">
<h1>Tracycle</h1>
</div>
<br>
<h3 align="center">Register with your email address</h3>
<br>
<form align="center" action="register.php" method="post">
<input type="email" id="textboxid" placeholder="Email" name="email" size="50" required>
<br><br>
<input type="password" id="textboxid" placeholder="Password" name="password" size="50" required>
<br><br>
<center><input type="submit" name="register" value="Register" ></center>
</form>
</html>
php code:
<?php
$host = "127.0.0.1";
$user = "tracycle";
$pass = "";
$db = "users";
$port = 3306;
$connection = mysqli_connect($host, $user, $pass, $db, $port)or die(mysql_error());
if(isset($_POST['submit']))
{
$email = $_POST['email'];
$password = $_POST['password'];
$check_email = "SELECT * FROM users_information WHERE email='$email";
$run = mysql_query($check_email);
if(mysql_num_rows($run)>0)
{
echo "This email already exists!";
}
$query = "INSERT INTO users_information (email, password) VALUES ('$email', '$password')";
if(mysql_query($query))
{
echo "Success!";
}
}
?>
BTW im using the cloud9 development environment
Do you know what is the problem and why the result is blank page?(after filling the html form and clicking the submit button) I'd love to get help :)