How do I get the full URL of the current page? I need to get the full URL of the currently opened page. I use the following code, but it returns http://localhost/mysite/page_name.  

$path = isset($_GET['q']) ? $_GET['q'] : '&lt;front&gt;';
$link = url($path, array('absolute' =&gt; TRUE));


It's not enough for my code to complete; I want to get the values that are passed with the URL as http://localhost/mysite/page_name/value1=value&amp;value2=value.

How can I do that?
Have you tried using request_uri()?

$_SERVER['HTTP_HOST'] . request_uri();


It should do the trick. I haven't tried it myself, and I may be off a bit, but I suggest you give a try.
From JavaScript, you could use the window.location.href variable.