[php] Open another page in php

Possible Duplicate:
PHP page redirect

how do i redirect to another page in php, once a process is finished.

for example my <form> tag sets the action attribute to "process.php". After the process on process.php is finished i want it to redirect to the site it cam from. how is that done?

This question is related to php redirect

The answer is


header( 'Location: http://www.yoursite.com/new_page.html' );

in your process.php file


<?php
    header("Location: index.html");
?>

Just make sure nothing is actually written to the page prior to this code, or it won't work.


Use something like header( 'Location: /my-other-page.html' ); to redirect. You can't have sent any other data on the page before you do this though.