I am trying to make a group chat on my website. In this code I have it write to a html file then redirect the user to the page. When I run this it says: Fatal error: Call to undefined function redirect() in C:\Program Files\Abyss Web Server\htdocs\groupchat.php on line 18 I can't figure out what's wrong. In /groupchat.php on line 18 it says redirect(/chat.htm); Can anyone help me?
No such function, a header redirect as already exampled is the closest thing to what you're looking for, you can create a function named "redirect" with the code already given by Kyosys.
Why? Header acts instantly, but it's required to be at the top of the page before any output is executed.
function redirect($link) { echo "<script language=Javascript> document.location.href='$link'; </script>"; }
php redirect is http://www.php.net/header header("Location: http://www.yoururl.com/yourpage.html"); or header("Location: /yourpage.html"); !