0

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?

Jay Blanchard
  • 32,731
  • 15
  • 70
  • 112
Alex
  • 13
  • 2
  • 3
    Did you try with session? Or else are you submitting a form? Please attach your code. – Oops Oct 31 '16 at 11:05
  • Check it out, it will help you - http://www.w3schools.com/php/default.asp – Antonios Tsimourtos Oct 31 '16 at 11:51
  • This scares me in so many ways. From @tadman: WARNING: Writing your own access control layer is not easy and there are many opportunities to get it severely wrong. Please, do not write your own authentication system when any modern development framework like Laravel comes with a robust authentication system built-in. – Jay Blanchard Oct 31 '16 at 12:22
  • **Never store plain text passwords!** Please use PHP's [built-in functions](http://jayblanchard.net/proper_password_hashing_with_PHP.html) to handle password security. If you're using a PHP version less than 5.5 you can use the `password_hash()` [compatibility pack](https://github.com/ircmaxell/password_compat). Make sure you ***[don't escape passwords](http://stackoverflow.com/q/36628418/1011527)*** or use any other cleansing mechanism on them before hashing. Doing so *changes* the password and causes unnecessary additional coding. – Jay Blanchard Oct 31 '16 at 12:22

2 Answers2

0

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'];
sg-
  • 2,071
  • 1
  • 13
  • 15
0

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;
?>
BIBIN JOHN
  • 354
  • 7
  • 13