Error redirecting when submitting data [SOLVED]
Posted: Fri Apr 20, 2012 1:12 pm
I have this code, for some reason it is no redirecting to the address I'd like to, yet it shows a plain blank page after submitting data.
It does submit the info but it just won't redirect me to google.
It does submit the info but it just won't redirect me to google.
Code: Select all
<?php
$connection = mysql_connect("localhost","root","root");
if (!$connection) {
die("Database connection failed: " . mysql_error());
}
$db_select = mysql_select_db("data",$connection);
if (!$db_select) {
die("Database selection failed: " . mysql_error());
}
$name = trim($_POST['name']);
$last = trim($_POST['last']);
$email = trim($_POST['email']);
$password = trim($_POST['pass']);
$password2 = trim($_POST['pass2']);
$query = "INSERT INTO staff_registered ( name, lastname, email, pass1, pass2 ) VALUES
('{$name}', '{$last}', '{$email}', '{$password}', '{$password2}' )";
if(mysql_query($query, $connection)) {
header("Location: http://www.google.com");
exit;
}else{
echo "<p>ERROR</p>";
echo "<p>" . mysql_error() . "</p>";
}
?>
<?php
mysql_close($connection); ?>