Jump to content

Sending a value with 'onClick'


essjay_d12

Recommended Posts

I am now trying to do it with sessions - the page I am sending it to is a pop up window yet it doesnt seem to echo out the session when I know it has set correctly in the previous page. here is my code

 

first page

session_start;
function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
	$pageURL .= "://";
	if ($_SERVER["SERVER_PORT"] != "80") {
		 $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
	} else {
  		$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
	}
	return $pageURL;
}
$_SESSION['URL'] = curPageURL();
echo $_SESSION['URL'];
echo "<input type=\"button\" name=\"web_data\" value=\"Web Page ...\" ".
             "onclick=\"return window.open('http://localhost/page2.php', 'web_data', 'menubar=1,location=1,directories=1,toolbar=1,scrollbars,resizable,width=800,height=600');\" />\n";

the Correct URL and button appears

 

Page 2

session_start;
echo $_SESSION['URL'];
echo " Hello";

 

But only hello appears!!!

 

Anybody explain?

 

cheers

 

d

Link to comment
Share on other sites

There are many other pages conflicting with this file, which may be doing a session_destroy - i cant view them to find out, is there another way (instead of sessions) how would I do the same thing using the function but possibly with cookies etc or any other ways?

Link to comment
Share on other sites

4 ways of transfering data page to page... get, post, sessions, cookies... if sessions are scratched, the next one that you prolly want to use for that is either get(use once(ish)), or cookies(use many times)...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.