PDA

View Full Version : Passing http:// address through to another page



Philip_Clark
February 14th, 2004, 05:02
I'm wanting to do the following:

Down the bottom of each page have a link called "Email this page to a friend".

How can I pass the address of the current page through to the next page with the form?

bloodyveins
February 14th, 2004, 09:04
we can make it simple.
at first page where the form exists, let's write:

<?php

$address = base64_encode($_SERVER['REQUEST_URI']);

?>
<form method="post" action="process.php">
<input type="hidden" name="address" value="<?php print $address; ?>" />
<input type="submit" value="Email this Page" />
</form>


And know the cgi, process.php


<?php

$address = base64_decode($_POST['address']);

if(!preg_match("/^http/",$address))
$address = $_SERVER['SERVER_NAME'].$address;

?>


The address to send is $address.

Wish this help