do not want to refresh screen in php code after back to the webpage

I have a webpage which user can buy goods online, after they order (order.php), they key in their contact (shipping.php), there is a button to link back to the order page in case they change their mind to add on order or to change order. Whenever the user click this button back to the order.php and amend order, then they proceed back to shipping.php again, all the shipping info that the user type in the shipping.php was wipe off, they have to re-type. How should I retain the user shipping info after amending the order and proceed to the shipping page??
Who is Participating?
Ray PaseurConnect With a Mentor Commented:
This explains how the session works.

As you may have noted, Amazon does not require the client to enter any kind of registration data until they are ready to make a purchase.  The process of requiring a registration before using other features of a web site is one of the surest tools the developer can use to guarantee that the clients will go away and not come back.  In fact, when Amazon changed this practice a few years ago, it put $300,000,000 on the bottom line in the year they fixed it.  So you might want to follow their model.

The session has one significant disadvantage: it disappears after a little while so you cannot recognize a returning customer.  Better to put a long-lived cookie on the browser and let it connect to a data base of client records.  Then when a request is presented with the cookie, you can say, "welcome back!"
Dave BaldwinFixer of ProblemsCommented:
You need to store the order info in your database and use it to re-populate the form when the shopper goes back to it.  This is pretty standard procedure for any kind of shopping cart.  When the order is finally placed and processed, then you mark it as finished so it doesn't get displayed again.
swpuiAuthor Commented:
I saw like Amazon, they retain the username password bcos their user have to create an user account, so this data will be kept in database. My page is much more simple, which I do not require user to create account also can purchase. Beside storing the info to the database, is there any alternative way??
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Chris StanyonCommented:
You could store the info in the SESSION. The principle is the same as Dave's suggestion but instead of writing the info to a database, you write it to the SESSION. You will need to include this at the very start of your pages

<?php session_start() ?>

You then set a session variable like so:

$_SESSION['someVariable'] = "Some Value";

You can then echo it back in your form like this:

<input type="text" name="someInput" value="<?php echo $_SESSION['someVariable']; ?>">

That's a very general overview and you'll probably want to read the man pages on session over at
swpuiAuthor Commented:
I will try
Ray PaseurCommented:
@swpui: According to the EE grading guidelines, you are required to explain a marked-down grade.  In this case you left the question open for months without response or comment, then gave the worst grade anyone can give at EE.  Please go back to your history and look at the grades you've been giving.  Out of the last ten questions, you've given only one grade of "A" -- this is unheard of in a forum where the default and expected grade is "A" unless the responses are demonstrably deficient.

Here is your history:

Here are the grading guidelines:

Please furnish your explanation for this, and please read the grading guidelines and take them to heart.  It will make the community more valuable for you if people think you will be a part of the program.

Thanks, ~Ray
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.