tsluss Posted April 4, 2007 Share Posted April 4, 2007 I was wondering if it were possible to code Javascript to assign values to Session variables? What I'm doing is creating a site that lists a summary of information in the database, when it lists the information one of the text line or a button will be used to open a new window and then list all of the information related to that database entry. For instance a persons name will be listed, then when you click their name (or a button beside their name) the new window will appear and list the information for that person. I thought using session variables from the main page then using them to pull the database value in the new window would probably be the best way to handle it unless someone else can recommend another way. If this is the best way though the only way I knew to make it work was to use a Javascript onClick event to assign a session variable a value and then use that in the new form as the values to pull from the database. Thanks in advance! Link to comment https://forums.phpfreaks.com/topic/45558-session-variables-and-javascript/ Share on other sites More sharing options...
benjaminbeazy Posted April 4, 2007 Share Posted April 4, 2007 couldn't you just pass a variable through the url and query the database in the new window with the variable. i.e. the id of the user Link to comment https://forums.phpfreaks.com/topic/45558-session-variables-and-javascript/#findComment-221196 Share on other sites More sharing options...
tsluss Posted April 4, 2007 Author Share Posted April 4, 2007 Normally yes, but in this case that presents a security risk and I don't want to pass variables through the URL. Link to comment https://forums.phpfreaks.com/topic/45558-session-variables-and-javascript/#findComment-221200 Share on other sites More sharing options...
kenrbnsn Posted April 4, 2007 Share Posted April 4, 2007 To do that you need to use AJAX. Ken Link to comment https://forums.phpfreaks.com/topic/45558-session-variables-and-javascript/#findComment-221206 Share on other sites More sharing options...
Captain_Pugwash Posted April 4, 2007 Share Posted April 4, 2007 does this mean you list the relevent data agianst each user listed. If so why not store it as a hddien field and then read the contents of the hidden field in javascript. this may make the page very 'top-heavy' if a lot of data is required. jsut a thought for something qucik and easy if not particularly elegent Link to comment https://forums.phpfreaks.com/topic/45558-session-variables-and-javascript/#findComment-221289 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.