简体   繁体   中英

How can i display GET output of a hyperlink on another php page (that includes the php page that contains GET request)

home.php

<?php
    include("header.php");
    include("session.php");
?>
<h3>Welcome <?php echo $login_session; ?></h3> 
<?php include("feed.php"); ?>

feed.php

<?php include("categories.php");
   function Qfeed($cat){
      //output is echoed here...
   }
   if(isset($_GET["cat"])) {
      $cat = $_GET["cat"];
      Qfeed($cat);
   }
?>

categories.php

<a href="./feed.php?cat=1"><li class="selected">All categories</li></a>

Problem: Everytime I hit the link 'All categories' from the home.php page, the output is displayed on feed.php. I want it to be displayed on the home.php page where feed.php has been included.

Because you are calling feed.php?cat=1 in link:

<a href="./feed.php?cat=1"><li class="selected">All categories</li></a>

Try calling home.php

<a href="./home.php?cat=1"><li class="selected">All categories</li></a>

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