-1

So I am making my first website and upon submitting data in my registration form, I get an error stating "Unexpected end of file" on line 43 of my document. I keep looking for errors and I haven't found any to my knowledge. I looked at other threads on this site and checked for the problems that were offered as solutions to others. Nothing. Can anyone help? Here is my code.

<?php
session_start();
include '../dbh.php';

$first = $_POST['first'];
$last = $_POST['last'];
$email = $_POST['email'];
$uid = $_POST['uid'];
$pwd = $_POST['pwd'];

if (empty($first)){
    header("Location:../signin.php?error=empty");
    exit();
}
if (empty($last)){
header("Location:../signin.php?error=empty");
exit();
}
if (empty($email)){
    header("Location:../signin.php?error=empty");
    exit();
}
if (empty($uid)){
    header("Location:../signin.php?error=empty");
    exit();
}
if (empty($pwd)){
    header("Location:../signin.php?error=empty");
    exit();
    } else{
        $sql ="SELECT uid FROM user WHERE uid='$uid'";
        $result = $conn->query($sql);
        $uidcheck = mysqli_num_rows($result);
        if ($uidcheck > 0){
        header("Location:../signin.php?error=username");
        exit();
}   else {
    $sql = "INSERT INTO user (first, last, email, uid, pwd) 
    VALUES ('$first', '$last', '$email', '$uid', '$pwd')";
    $result = $conn->query($sql);

    header("Location:../index.php");

1 Answers1

0

Add these two lines:

}
?>

to the end of your script.

Kaylined
  • 655
  • 6
  • 15