0

So I've searched all over and found all sorts of solutions that just don't work.

I have a registration page that inserts data into my database, which works. I have an if/else statement that should redirect to one of two pages depending if the insertion was successful or not. Right now it just shows a blank page after the form is submitted.

<?php

$hostname="xxxxxxxxxxxxxxxxxxxxx";
$username="xxxxxxxxxxxx";
$password="xxxxxxxxx";
$database="xxxxxxxxxxxxx";



$db = new mysqli($hostname, $username, $password, $database); 
if ($db->connect_error){
    die("Connection failed: " . $db->connect_error);
    }

$pw = $_POST['pw'];
$UIN = $_POST['UIN'];

$sql = "INSERT INTO studentLogin (pw, UIN) VALUES ('$pw', '$UIN')";

if ($db->query($sql) === TRUE) {
    header('Location: http://my_url/success.php.php?msg=WELCOME STUDENT');
    exit();
}  else {
    header('Location: http://my_url/failure.php.php?msg=You must be a student to register for the student discussion page');
    exit();
}

$db->close();

?>
Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141
Indyvette
  • 15
  • 4

1 Answers1

-1

An URL cannot contain spaces. You should change the spaces into "%20", which is the percent-encoded equivalent of a space. There's more info on percent encoding on this page. You can also use the "+" symbol to symbolize the space character.

Also, consider enabling errors. If you do not, we will not be able to know what exactly is the issue (which there definitely is one, considering the fact that the page is not showing.)

adrian
  • 1,439
  • 1
  • 15
  • 23