Liam Delahunty: Home Tips Web Contact
Recommended laptop
under £500

Think I deserve a present? See my Amazon Wish List

PHP Javascript passing values to new window in url

I have a send to a friend script that opens in a new window using JavaScript. I want to be able to pass the full URL with the query string to a new window, and have that sent in a new form.

Firstly click here to add some variables to this page. If you look at the location bar, you will see the URL has changed to ?a=123&b=qwe&c=def.

Mail To a Friend (doesn't work properly!)

The above link looks okay, and has all the vars, but when you actually click the link for the new window, only the first variable appears in the important (to the new form) $q string. The others go, but I'd need to perform a foreach to see them all. I want to be lazy and just process the string, not have to think about the _GET and the vars it contains.

So I actually replace the & signs with a semi-colon first and then send that in the string, like so...

$q = eregi_replace("\&", ";", $_SERVER["REQUEST_URI"]);

Mail To a Friend that works with multiple variables.

Then in the new page, email_to_a_friend.php, I perform the opposite eregi_repalce to change al the semi-colons back into & so the browsers/email clients understand.


\n"); :e php_server_v

Share this!  

Php Google Referer | Php Javascript Passing Values To New Window In Url | Php List A Directory


  Tips | Home | Search | Contact

Link here: