Avatar of ellandrd
ellandrd
Flag for Ireland asked on

create session from javascript value

how can i create a PHP session from a javascript value?
PHP

Avatar of undefined
Last Comment
ellandrd

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
hernst42

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
ellandrd

ASKER
isnt this creating a javascript value based on a PHP value?  i want the opposite.
hernst42

Maybe you can explain a little more in detail what you want. The given example sends two java-script variable to php.
ellandrd

ASKER
ok i cant find anything to help me in the documentation.

this is what im trying to do:

i have a parent window with a button.  when clicked i open a popup window.  i want to get the URL of the parent window.  i then want to use this parent window url to decide which page i return to when i close the child window.

so far i can get the url of the parent window and display it using a alert().  
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
ellandrd

ASKER
maybe this will help too.  here my my code to close the popuo window and return to parent:

$html .= '<td><a href="javascript:void(0);" title="Use this Template" onclick="javascript:window.opener.location=window.parent.opener.location+"?cat_id="'.trim($rows['CatID']).'\';self.close();return true;">Use</a></td>'."\n";
                        
ellandrd

ASKER
ok i think that was a bad example.  

lets try again. my popup window contains a list of hrefs.  when one of these links are clicked i want to set the location of parent window and also pass back a value and close the popup.

$url = 'javascript:window.opener.location=window.opener.location?cat_id='.trim($rows['CatID']).';self.close();return true;';
                                          
$html .= '<a href="javascript:void(0);" onclick="'.$url.'">Use</a>'."\n";

But it isnt working - im getting  a syntax error.
                        
ellandrd

ASKER
thanks for the help.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.