dstnlhhv791576
dstnlhhv791576
2010-10-11 13:26

PHP页面之间丢失会话数据?

已采纳

I am making a news add form using post method. In the second page i make data validation. I define the variables like $message = $_POST["message"] and after that $_SESSION['message'] = "$message"; after that I echo the session var and everything look fine the data appear. And when I click to send which go to another page to add the data to the DB the session vars a empty. There is session_start on every page if i define veriable like $_SESSION="test" it passess all 3 pages but the data generated in the form is lost. Please help!

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • doujie7346 doujie7346 11年前

    $_SESSION="test" is overwriting all of your session data.

    Instead you should do what you are doing in other places and use $_SESSION['test']="test".

    This will put a new item into your $_SESSION array instead of overwriting all session variables.

    点赞 评论 复制链接分享

相关推荐