php to html page redirection after performing a db insert query – PHP



My php script performs a insert query ,
Then i want it to go to another html page.
header(‘Location : <url>’) not working.
I an working on wamp server.


The problem is lines 24 thru 30. Delete them and all will be well. 😉

If you want serious answers, you’ll need to post your code and explain what you mean by "not working". Do you receive any error message? Does it redirect to the somewhere else? Does it cause your computer to catch on fire?


My code:

$con = new mysqli("localhost:3306","root","","parking");
die("connectionn failed".$con->connect_error);
$url='localhost/4 user hame page.html';
$con->query("INSERT INTO `user` (`name`, `age`, `gender`, `phone`, `mailid`, `uname`, `pwd`) VALUES ('$nam', '$ag', 'f', '$pho', '$mai', '$uname', '$pwd')");
header("Loaction: localhost/4 user home page.html/");

not working in the sense nothing happens, i.e no redirection or error.


Do you have error reporting enabled?

Do you get a blank page, or something else?

Are you using the full URL in the redirect, or a relative path? If it’s a relative path, you should change it to the full URL.


blank page only.
it’s the full url


Please use code tags when posting code or formatted data.

Does it insert the data?

Your problem is line 19. You spelled Location wrong.

Also, your other problem is line 19. Unless the client is viewing this page from the same computer that the web server is on, the client computer can’t resolve the localhost reference.


Thanks got it , after the spelling correction .