Welcome to WebmasterWorld Guest from 54.226.189.112

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Passing Variables to Other File

     

domingo

1:35 pm on Jun 20, 2002 (gmt 0)

10+ Year Member



Please help me, What I am doing Wronge in passing parameters

file 1:
<html>
<body>
<script language="php">
$remoteip = getenv("REMOTE_ADDR");
</script>
<a href="two.php?myip=$remoteip">Referers</a>
</body>
</html>

file 2:
<html>
<body>
<script language="php">
$remoteip = urlencode($myip);
echo $remoteip;
</script>
</body>
</html>

The second file, does not print the IP of the visitor whihc is captured in file No. 1

Please help :(

Aamir

Lisa

3:12 pm on Jun 20, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



file 1:
<html>
<body>
<?
$remoteip = getenv("REMOTE_ADDR");
?>
<a href="two.php?myip=<? echo $remoteip; ?>">Referers</a>
</body>
</html>

file 2:

<html>
<body>
<?
$remoteip = urlencode($myip);
echo $remoteip;
?>
</body>
</html>

In the href in file one, the variable was not in PHP's scope. Now it is.

Nick_W

3:26 pm on Jun 20, 2002 (gmt 0)

WebmasterWorld Senior Member nick_w is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Yes, and you can alter this slightly to the shorthand:
<? echo $remoteip; ?>">

becomes

<?=$remoteip;?>">

Nick

domingo

4:16 pm on Jun 20, 2002 (gmt 0)

10+ Year Member



Thanks a lot both of you, it solved the problem :)

Aamir

 

Featured Threads

Hot Threads This Week

Hot Threads This Month