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??
swpuiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.
0
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??
0
Chris StanyonWebDevCommented:
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 php.net:

http://www.php.net/manual/en/book.session.php
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Ray PaseurCommented:
This explains how the session works.
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_11909-PHP-Sessions-Simpler-Than-You-May-Think.html

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!"
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
swpuiAuthor Commented:
I will try
0
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: http://www.experts-exchange.com/memberQuestionHistory.jsp?mid=3037064

Here are the grading guidelines: http://support.experts-exchange.com/customer/portal/articles/481419

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
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.