I have a class that inserts users into a database, although I'm having a little trouble initialising header() re-direct. Here is my code
public function Register() {
$username = $_POST['username'];
$password = $_POST['password'];
$query = mysql_query("INSERT INTO users (username, password, admin) VALUES ('$username', '$password', '0')");
header('Location: /view_registered.php?register=success');
}
Is there a way I can put the header within a variable then once the method's complete adding users to the db then pass the header variable back to my index.php page?
kind regards
Try adding a .
header('Location: ./view_registered.php?register=success');
If in a folder below
header('Location: ./../view_registered.php?register=success');
If in a folder above
header('Location: ./FOLDER_NAME_HERE/view_registered.php?register=success');
If in a different place altogether
header('Location: http://www.google.com');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With