I have an input in a contact form to record the users IP address:
<input type="text" class="form-control" name="ip" value="<?php echo $_SERVER['REMOTE_ADDR']; ?>" disabled>
This works ok. It shows the users IP address when they are completing the contact form.
The problem is including this in the e-mail.
I am including it in the e-mail using:
$ip = $_POST['ip'];
but it generates this error message on send:
Notice: Undefined index: ip in /var/www/contact.php on line 51
I don't get this error message with any other inputs so I assume it is to do with using disabled
in the form?