Results 1 to 3 of 3

Thread: Embedding an IP tracking script into form.

  1. #1
    Join Date
    Mar 2007
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Embedding an IP tracking script into form.

    Hello,

    I would like to embed an IP tracking script into my HTML form so when a person completes the form, I receive the email with the info they submitted along with their IP address.

    From my understanding, I need to somehow include the following PHP code into my form?

    PHP Code:
    $ip=$_SERVER['REMOTE_ADDR']; 
    My question is, how do I go about inserting the above code into my form and have it show up in the form submittal email? I am not all that familiar with PHP coding so need as much help as possible.

    Thank you!

  2. #2
    Join Date
    Jan 2007
    Posts
    629
    Thanks
    10
    Thanked 28 Times in 28 Posts

    Default

    PHP Code:
    <form action="" method="post">
       <input type="hidden" name="ipaddress" value="<?php echo $_SERVER['REMOTE_ADDR']; ?>" />
       <!-- the rest of the form //-->
    </form>
    Save the file with a .php extension (not .html) and upload it to a php enabled server. The value of the hidden input "ipaddress" will be the users IP. (The way you would get the value is the same as any other type of input in your form.)

    Hopefully that helps a little bit.
    --Jas
    function GreatMinds(){ return "Think Like Jas"; }
    I'm gone for a while, but in the meantime: Try using my FTP script | Fight Bot Form Submissions

  3. #3
    Join Date
    Mar 2007
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Jas View Post
    PHP Code:
    <form action="" method="post">
       <input type="hidden" name="ipaddress" value="<?php echo $_SERVER['REMOTE_ADDR']; ?>" />
       <!-- the rest of the form //-->
    </form>
    Save the file with a .php extension (not .html) and upload it to a php enabled server. The value of the hidden input "ipaddress" will be the users IP. (The way you would get the value is the same as any other type of input in your form.)

    Hopefully that helps a little bit.
    Jas - It helped a lot! Had some trouble at first but got it working once it was uploaded to a PHP-enabled server. Thank you for taking the time!

    Jarik

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •