简体   繁体   中英

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?

Do you mean a redirect?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM