Click to See Complete Forum and Search --> : Echo IP in php rather than in shtml - help please


barkalama
09-12-2007, 02:52 PM
I'm using the following script to echo IP:

--------------------------
var ip = '<!--#echo var="REMOTE_ADDR"-->'

function ipval() {
document.myform.ipaddr.value=ip;
}
window.onload=ipval
-----------------------------------

The problem is it only works when I save the file as .shtml !!!

I need this to work in .php file. Is there anything I can do to make this work in .php file?

Please advice, thank you

Znupi
09-12-2007, 03:38 PM
<?php echo $_SERVER['REMOTE_ADDR'];?>