Web Hosting Talk







View Full Version : Adding IP info to my form (PHP)?


sabian1982
05-19-2006, 05:44 AM
Ive just completed a php mailer that uses a form to send quite a lot of information to a specfied email address! The one thing that i have missed is that i want (when the email arrives) the IP address of the person who submitted the email via the form? is there a predefined variable for this? if so what is it? or how do i do it?

wolseley
05-19-2006, 05:56 AM
Yes, there is a predefined variable for this: $_SERVER['REMOTE_ADDR']

sabian1982
05-19-2006, 07:07 AM
thats the one cheers, is there any other information that would be useful that i should add in?

zacharooni
05-19-2006, 09:24 AM
<?PHP

$IP_ADDY = getenv("REMOTE_ADDR");

echo "Your IP has been logged as {$IP_ADDY}<br />";

?>