faya
faya

Reputation: 5715

Including one PHP file in another

How can I go from one *.php file to another *.php file ? For example, if I have this in index.php:

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

and this in second.php:

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

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

Upvotes: 0

Views: 165

Answers (1)

erenon
erenon

Reputation: 19118

Do you mean a redirect?

header('Location: index.php');
exit;

Upvotes: 3

Related Questions