2009-11-23, 02:36 AM
I am having an issue with a PHP code. I want to set it so that when somebody submits a form, their IP address is written to a text file for later use.
This works, but is not what I want
This is what I want, but it doesn't work
Please help. Thanks
This works, but is not what I want
$ip = $_SERVER['REMOTE_ADDR'];
$fh = fopen("iplog.txt", "a");
fwrite($fh, $ip);
fclose($fh);
if (isset($_POST['submit'])) {
This is what I want, but it doesn't work
if (isset($_POST['submit'])) {
$ip = $_SERVER['REMOTE_ADDR'];
$fh = fopen("iplog.txt", "a");
fwrite($fh, $ip);
fclose($fh);
Please help. Thanks