php 和 html 注册页面结果是空白页

标签 php mysql

我正在尝试为学校的一个项目创建一个网站。第一步应该很简单——注册和登录页面。 PHP 代码从来没有工作过...(有时是由于代码中的问题,大多数时候结果是空白页)。

html代码:

<!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代码:

<?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!";
    }
}

?>

顺便说一句,我使用的是cloud9开发环境

您知道问题出在哪里吗?为什么结果是空白页?(填写 html 表单并单击提交按钮后) 我很想得到帮助:)

最佳答案

if(isset($_POST['submit']))

必须是

if(isset($_POST['register']))

也尝试激活显示 PHP 错误: How do I get PHP errors to display?

关于php 和 html 注册页面结果是空白页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34473843/

相关文章:

php - Paypal 'Buy Now' 按钮不允许我动态设置价格

php - 如何提取字符串中的所有 anchor 标记、它们的 href 和 anchor 文本?

mysql - 按日和月(php 时间戳)对结果进行分组,显示每天的总收入

mysql - 为什么 _ 在 MySQL 中特别?

php - SQLi 并检索特定记录

php - fatal error : Call to a member function prepare() on a non-object in pdo

php - 使用php5在mysql中注册用户帐户

php - 使用 php 循环遍历 mysql 表以查找字母成绩的平均成绩

MySQL 查询分组条件计数

php - session /数组问题,购物车