homepage Welcome to WebmasterWorld Guest from 54.227.171.163
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Passing Variables to Other File
domingo

10+ Year Member



 
Msg#: 451 posted 1:35 pm on Jun 20, 2002 (gmt 0)

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

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 451 posted 3:12 pm on Jun 20, 2002 (gmt 0)

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

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



 
Msg#: 451 posted 3:26 pm on Jun 20, 2002 (gmt 0)

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

becomes

<?=$remoteip;?>">

Nick

domingo

10+ Year Member



 
Msg#: 451 posted 4:16 pm on Jun 20, 2002 (gmt 0)

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

Aamir

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved