I am Newbie when it comes to adding/Editing code. Can you please tell me exactly where to add these two scripts? You said to add "to between the form tags and the form page and saved as .php" I am not sure what this means or what to do. I am fairly experienced with editing the process.php and changing sender name and Subject Title. If you could please clairfy where to add the code or what file to create, it would help me tremendously! Any information is much appreciated.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I need to add some code to my form to log the submitter's IP address or location. It could be sent to me alongside the other form information.
Can anyone advise how to do this?
Many thanks in advance
Mavi
Ok I made it work myself like this:
1) I added this code to between the form tags on the form page and saved as .php type file:
<?php
$ipi = getenv("REMOTE_ADDR");
?>
<input type="hidden" name="ip" value="<?php echo $ipi ?>" />
2) On the processer file, I added this to the variables at the start:
$ip = $_POST['ip'];
and this to the part to be printed out in the email sent:
Additional Info : " . $_POST['ip'] . "
I am Newbie when it comes to adding/Editing code. Can you please tell me exactly where to add these two scripts? You said to add "to between the form tags and the form page and saved as .php" I am not sure what this means or what to do. I am fairly experienced with editing the process.php and changing sender name and Subject Title. If you could please clairfy where to add the code or what file to create, it would help me tremendously! Any information is much appreciated.
Awesome job maviblue...it works great. Thank you very much.
phyrex: open form.html and edit the source code (open it with Notepad or something)
Look for <form>
blah, blah blah
blah blah blah
blah, blah blah
blah blah blah
</form>
Enter: <?php
$ipi = getenv("REMOTE_ADDR");
?>
<input type="hidden" name="ip" value="<?php echo $ipi ?>" />
in one of the blank lines between the other code:
<form>
blah, blah blah
blah blah blah
<?php
$ipi = getenv("REMOTE_ADDR");
?>
<input type="hidden" name="ip" value="<?php echo $ipi ?>" />
blah, blah blah
blah blah blah
</form>
then SAVE the form.html as form.php. Now upload the form.php to your site replacing form.html
Then open processor.php with notepad and do what mavibue says to do with that.
good luck,
darren
Thanks darren_ =) Very helpful for a newbie like me. Much appreciated!