How to redirect in PHP, using javascript in PHP.
TAGS: redirect, javascript, webpage, HTML, PHP


I was looking for a way to redirect in PHP code to an URL, but I ended up using a small snip of javascript.
It looks like so:


As you can see the page mypage.php is called by this snippet.
The little, but obvious trick is to use the close tag for the PHP code, then do the JS thing and then give the PHP start tag again, returning to the program.
Maybe not elegant, but it's working.