barbs75 Posted May 15, 2008 Share Posted May 15, 2008 Hey guys, Wasn't sure which forum to post this in, so i went with this one!!! 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 Link to comment https://forums.phpfreaks.com/topic/105754-js-to-read-php-_session-data-from-previous-page/ Share on other sites More sharing options...
StormTheGates Posted May 15, 2008 Share Posted May 15, 2008 I believe you can input php variables into javascript like this. <script language="javascript"> houseprice = <?php echo "$houseprice"; ?> </script> Not entirely sure though. Link to comment https://forums.phpfreaks.com/topic/105754-js-to-read-php-_session-data-from-previous-page/#findComment-541907 Share on other sites More sharing options...
RichardRotterdam Posted May 15, 2008 Share Posted May 15, 2008 yes you can just posted the same answer on the javascript section Link to comment https://forums.phpfreaks.com/topic/105754-js-to-read-php-_session-data-from-previous-page/#findComment-541909 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.