barbs75 Posted May 15, 2008 Share Posted May 15, 2008 Hey guys, Right, what i'm trying to do is have one of those features on a form, where you can click a button saying 'is your billing address the same as your home address?' and then if you click on it, it copies the data into the fields for you. I have a page on my user profile system, where the user can update their home address, which is then stored in my database, and stored in php $_SESSION data. I then have a house upload page, where the user can upload a house to sell, where they have to enter the address of the house they are selling, the house might not be teh same as their home address, or it might be. So i want to give the option of clicking a button to copy the session variables into the fields automatically if their billing address is the same. Is Javascript teh best way to do this? and can javascript read in the data from the php sessions and put them in the text fields??? I'm sure this is a really simple procedure, it is quite a common function on forms that i have seen on the web, if anyone can help me out, or know any examples etc, any help will be welcomed!! cheers guys Craig Quote Link to comment Share on other sites More sharing options...
RichardRotterdam Posted May 15, 2008 Share Posted May 15, 2008 directy no... javascript cant read the server sessions but however you can simply make php echo javascript <script> var sessionData=<?php echo($_SESSION['your_session'])?>; </script> Quote Link to comment Share on other sites More sharing options...
barbs75 Posted May 19, 2008 Author Share Posted May 19, 2008 Dj Kat, cheers for your reply!! Craig Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.