duanmao9918 2016-02-18 15:34
浏览 12
已采纳

将原始页面上的“提交”按钮发送到另一页后显示

I have 2 web pages. One is called web1.php and the other is web2.php. I have a menu on the top of both pages that calls both pages through links.

I have to be able to pass and display the "submit" button that is pressed (there are 3 buttons, one called "Hi", "Hello", "Hola") in web1.php to web2.php and then clink the link for web1.php on my header and have it also display there when I return to that page "You previously pressed hi".

I can get it to display on web2.php but don't know how to get to display again after pressing the link.

web1.php

      <input type="submit" value="HI" name="HI"> 
      <input type="submit" value="HELLO" name="HELLO">
      <input type="submit" value="HOLA" name="HOLA">

web2.php

   if ( $_POST['HI'] )
   { 
      echo "called using the HI";
   }
   else if ( $_POST['HELLO'] )
   { 
      echo "called using the HELLO Button";
   }
   else if ( $_POST['HOLA'] )
   {  
      echo "called using the HOLA Button";
   }
  • 写回答

1条回答 默认 最新

  • douhuanbai6729 2016-02-18 15:54
    关注

    You can use session to save action when you click button in web1.php web2.php

    if ( $_POST['HI'] )
       { 
          $_SESSION['button'] = 'Hi';
          echo "called using the HI";
       }
       else if ( $_POST['HELLO'] )
       { 
          $_SESSION['button'] = 'Hello';
          echo "called using the HELLO Button";
       }
       else if ( $_POST['HOLA'] )
       {  
       //...same above
          echo "called using the HOLA Button";
       }
    

    Then in your web1.php you can echo $_SESSION['button']

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么