Solved

Any way to "share" PHP session variables between two domains?

Posted on 2011-03-23
3
287 Views
Last Modified: 2012-05-11
We have two websites featuring two aspects of our business: metrology and robotics. As these two are related, we have many links between these two sites, and they are designed to work seamlessly - they even look similar.
We don't have any LOG IN forms on either one of the sites, but, we have "quote request" forms for different items. Many times, a customer will fill out their info in one of the forms and request the quote, I would save their contact info in PHP session variables and when they move onto another quote request during the same visit, their contact info is pre-filled in the form.  It is convenient to the customer, but...

but, of course, once they leave one site and go to our other site, the session variables are lost.

Is there any way to retain the session variables values between two sites?
0
Comment
Question by:Erie_Laker
  • 2
3 Comments
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 35202085
No, not without explicitly transferring them.  You would have to read them all and pass them via a POST to the other site.

The other choice is to put all that in a database which you can share between sites.  You would have to come up with another way to track the customer but that's doable.
0
 

Author Comment

by:Erie_Laker
ID: 35301581
@Dave
"The other choice is to put all that in a database which you can share between sites.  You would have to come up with another way to track the customer but that's doable."

Could you please explain how?
0
 
LVL 82

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 35301733
You can set up databases like MySQL and MS SQL so they can be accessed from anywhere with a username and password.  I edit the databases on my websites from a page running on the webservers here at home.  The database server(s) is independent from the web servers.

So if you save the original info from either site in the database, you can access it again when your customer goes to the other site.  You would still have to come up with a way to recognize them because cookies and session data don't transfer between sites.  Some kind of login in the original quote form would do.  Note that once it's in the database, it doesn't disappear with the customer and you can access it later if you want to.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction Many web sites contain image galleries; a common design for these galleries includes a page with a collection of thumbnail images.  You can click on each of the thumbnail images to see the larger version of the image.  This is easily i…
Consider the following scenario: You are working on a website and make something great - something that lets the server work with information submitted by your users. This could be anything, from a simple guestbook to a e-Money solution. But what…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now