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
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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.