Link to home
Create AccountLog in
Avatar of ellandrd
ellandrdFlag for Ireland

asked on

create session from javascript value

how can i create a PHP session from a javascript value?
Avatar of hernst42
Flag of Germany image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of ellandrd


isnt this creating a javascript value based on a PHP value?  i want the opposite.
Maybe you can explain a little more in detail what you want. The given example sends two java-script variable to php.
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().  
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";
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.
thanks for the help.