what exactly you trying to do?
the IP is transfered from script to script over the URL ?
then you want to replace the link on the page with the IP like page.php?ip=iphere
that would be
$ip = $_GET['ip'];
and then in every link just put the ?ip=$ip after the pagename