My goal is to redirect a user who tries to search for data that is not found in a db, back to the page that has the search form. So the flow is begins in form.php where user enters the id number and he is taken to the page that has the queries on the db processform.php,if there is no results, he/she is to be taken back to the search form. I have used the header function
header("Location: http://".$_SERVER['HTTP_HOST']."/<folder>/so.php");
Unfortunately this is giving the usual error:
Warning: Cannot modify header information - headers already sent by (output started at C\xampp\htdocs\proj\header_n_menu.php
I have also tried the
http_redirect("http://localhost/so.php");
But that gives out this error:
Uncaught Error: Call to undefined function http_redirect() in C:....
Is there any other way you redirect my users to another page automatically?