Home > Net >  mysqli_connect() no response or not connecting
mysqli_connect() no response or not connecting

Time:08-11

I am trying to create a small sign up/login system with HTML, PHP and a database. If I filled in the data and click 'submit', I get linked to the next php file, but nothing happends.

My HTML looks like this:

<!DOCTYPE html>
<html lang="en">
    <head>
    <meta charset='utf-8'>
        <title>Create case</title>
    </head>
    <body>
        <section>
            <h2>Sign up</h2>
            <form action="includes/signup.inc.php" method="post">
                <input type="text" name="name" placeholder="First name">
                <input type="text" name="email" placeholder="Email">
                <input type="text" name="uid" placeholder="Uid">
                <input type="password" name="pwd" placeholder="Password">
                <button type="submit" name="submit">Save</button>
            </form>
        </section>
    </body>
</html>

So when you press 'Submit', the next code will be executed.This is signup.inc.php:

<?php

if (isset($_POST["submit"])) {
    echo "It works!";
}
else {
    header("location: ../signup.php" );
    exit();
}

For the connetion to the database I used this code:

<?php

$dbServername = "localhost";
$dbUsername = "root";
$dbPassword = "";
$dbName = "system";

$conn = mysqli_connect($dbServername, $dbUsername, $dbPassword, $dbName);

if (!$conn) {
    die("Connection failed: ". mysqli_connect_error());
}

Those are three seperate files. My server runs with XAMP.

I have no idea what's going wrong. After I submit the data the page is just blank. The URL shows the correct file.

Any help would be appriciated!

CodePudding user response:

A blank page could be the sign of an uncaught Exception

try to catch it!

try {
// your code } catch (\Exception $e) {
var_dump($e->getMessage());}

CodePudding user response:

its hard to tell with limited information. But my guess is there is something wrong with the signup.php file because you did said that the url was right, it just nothing appear. Please edit and includes the complete files ( of course just hide the sensitive info)

  • Related