dsg7513
2016-10-31 11:04
浏览 90
已采纳

如何从一个PHP到另一个PHP获取文本框值

Currently I am working on php project. I tried to bring textbox value, which is

$password = $_POST['password'] 

from Forgotpassword.php to Thank-You.php file.

A lot of people advised me to put include('Forgotpassword.php') on Thank-You.php but when I put include('Forgotpassword.php') on Thank-You.php, whole form from forgotpassword.php was showed on Thank-You.php. I just want to retrieve only textbox value on Forgotpassword.php.

Any idea?

图片转代码服务由CSDN问答提供 功能建议

目前我正在开发php项目。 我试图带上文本框值,即

  $ password = $ _POST ['password'] 
   
 
 

从Forgotpassword.php到Thank-You.php文件。

很多人建议我把包含('Forgotpassword.php')放在Thank-You.php 但是当我 将include('Forgotpassword.php')放在Thank-You.php上,来自forgotpassword.php的整个表单在Thank-You.php上显示。 我只想在Forgotpassword.php上检索文本框值。

有什么想法吗?

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • dongmen1860 2016-10-31 11:24
    已采纳

    You can done it by using session, in your Forgotpassword.php

    <?php
    session_start();
    $data=$_POST['key'];
    $_SESSION["variable"] = $data;
    ?>
    

    And in your thankyou.php

    <?php
    session_start();
    $data=$_SESSION["variable"];
    echo $data;
    ?>
    
    已采纳该答案
    评论
    解决 无用
    打赏 举报
  • drsb77336 2016-10-31 11:23

    Forgotpassword.php:

    <form method="post" action="Thank-You.php">
        <input type="password" name="password" />
        <input type="submit" value="Submit" />
    </form>
    

    Thank-You.php:

    <?php $password = $_POST['password'];
    
    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题