doujiao1949 2014-10-19 12:05
浏览 14
已采纳

检索两页的$ _POST

I need to save my submit form data like:Name for two pages... For some reason the $_POST only saves data for the "action" page, but cannot be retrived after the action page. Here's my code: HTML (form):

 <html> 
 <body> <form name="input" action="staff.php" method="post"> 
         Username: <input type="text" name="Name">
        <input type="submit" value="Submit">
</form> 
</body>
</html>

Here's the next page after submiting and it works... (staff.php)

<html>
<?php 
session_start(); 
echo "You have choosen". $_POST['Name']; // it shows what you've choosen... 
 ?> 
<form name="input" action="staff2.php" method="post">
Age: <input type="text" name="Age">
<input type="submit" value="Submit">
</form>  
</html> 

Ok and after age submiting Name and Age stop working... (staff2.php) Here's the code:

<?php
session_start(); 
echo "You have choosen". 
$_POST['Name'];  //it does't show Name.. Please help! 
$_POST['Age']; // it doesnt't show this either..  
?> 
  • 写回答

2条回答 默认 最新

  • du21064 2014-10-19 13:19
    关注

    as you have a session running pass them as session variables.

    $_SESSION['name'] = $_POST['name'];
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题