views:

64

answers:

1

Hello,

I have a question: How go from one *.php file to another *.php ? In example if I have this in index.php

<?php 
 <form method="POST" action="second.php">
 <input type="button" name="GO">
 </form>
?>

and in another second.php:

  <?php
    if ($_POST['GO'])
         // HERE SHOULD BE SOME CODE LIKE INCLUDE OR SMTH TO GO TO index.php
  ?>

I have tried include('index.php'); , but it doesn't work at all. Any suggestions?

+3  A: 

Do you mean a redirect?

header('Location: index.php');
exit;
erenon
For that to work you'll need to not have already started outputting data to the client, otherwise PHP will yell at you.
Dominic Rodger