Jump to content

Help remembering form results


zeroecko

Recommended Posts

Hi,

I am fairly new to php programming.  I am creating a script that requires users to go between 2 pages.  Sadly, I cannot keep this to one page.  Anyway, I want to make the script remember what the form results were, even after leaving the page.

 

Right now, if I leave the page and go back, all values are reverted back to the default.  I am trying to create a store using php, but it is not working out.  I was hoping to avoid using a database, or delete the information off the database after I am done.

 

Any help on this would be great.

Link to comment
https://forums.phpfreaks.com/topic/175296-help-remembering-form-results/
Share on other sites

Hi,

I am fairly new to php programming.  I am creating a script that requires users to go between 2 pages.  Sadly, I cannot keep this to one page.  Anyway, I want to make the script remember what the form results were, even after leaving the page.

 

Right now, if I leave the page and go back, all values are reverted back to the default.  I am trying to create a store using php, but it is not working out.  I was hoping to avoid using a database, or delete the information off the database after I am done.

 

Any help on this would be great.

 

on the page your form posts to:

 

put this at the top of both pages:

 

session_start();

 

then save the post variables into session variables

 

$_SESSION['username'] = $_POST['username'];

 

then on the page where you have your form, set value="$_SESSION['username']" and if it's empty it won't matter so you don't have any need for an if statement

 

hope that helps

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.