Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 8 of 8
  1. #1
    Junior Member
    Join Date
    Sep 2014
    Posts
    4
    Member #
    40259

    Capture submitter's IP address from web form

    Good morning folks! It's been quite some time (10 years ) since I've dabbled with HTML, PHP, JavaScript, etc. and I'm recently getting back into the game with a simple web-page I've been working on for a new business I have started.

    I'm using a CRM with Zoho.com, and I have a web form on my web site that a client fills out, and upon submitting the information all fields from the form go directly into the CRM. This function has been working perfectly. I've also created a few custom fields in the CRM and then placed <input> tags for those fields on the web form, which has successfully submitted the data from the web form to the CRM.

    Today I've decided that I want to capture the IP address of the person submitting the form (to weed out people who are possibly claiming to be different people from the same IP address). All I'm simply looking to do is have a new, hidden <input> field capture the submitter's IP address so I can send it to the field I created in the CRM. The only important part is that the "name" of the hidden field for the IP address must be "LEADCF17", or it will not make it into the CRM at all, let alone the custom field I created to accept the IP Address that I plan on plugging in via the web form.

    I did some research on the Internet this morning and found several methods that don't seem to capture anything. The one that looked the most promising was this:

    HTML Code:
    <input type="hidden" name="LEADCF17" value="<?php echo $_SERVER['REMOTE_ADDR']; ?>">
    The "value" portion does not seem to capture anything. Again, I have done all other custom, hidden fields successfully this same way in this form, using the "name" required for that specific custom field, and putting whatever I want in the "value" section.

    I also saw another method that requires you to use a different "name", which obviously will not work in this situation. I am using a .php file extension on this file (it is my index.php file) but not sure if I'm missing something else that is required in the <head> section or anywhere else aside from the simple <input> field I provided above. Any ideas??? Thank you!!

    -Andrew

  2.  

  3. #2
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    That code should work, although it's not the best way to deal with it...the best way would be to send a PHP cURL request with the IP and other form data captured that way.

    What do you mean "does not seem to capture anything"? What shows up in the value field? Anything? Nothing?

    Also, what's the URL so we can have a look and see what's going on?
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  4. #3
    Junior Member
    Join Date
    Sep 2014
    Posts
    4
    Member #
    40259
    Thanks for the assistance TheGAME. I wouldn't mind going the route that you suggest, but I'm concerned it's going to overly-complicate things with the form... at least complicate them behind my comprehension and capabilities lol. When I go to the CRM, the field I created for the IP address comes out empty as if it didn't pull anything from the web form. The other custom fields I am using as well as the rest of the fields populate just fine.

    The web address for my site is www.prestigewholesalehomes.com. Thanks again!!!!!!

  5. #4
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    The PHP portion is working....the IP is definitely in that field. So if it's not capturing, there are a few possibilities:

    1) The CRM doesn't actually use the field LEADCF17 and uses something else (possibly a typo or reversal of letters).
    2) You need to close your input tag. " />" instead of ">" (with the space in the first one, without the quotes overall).
    3) You have some other validation issue preventing the field from submitting properly. [Invalid] Markup Validation of http://www.prestigewholesalehomes.com/ - W3C Markup Validator

    The best thing you can do to isolate this issue is to see if to take the form (just the form and nothing else), put it on a blank page, make sure the code on the blank page is valid, and see if everything submits properly. If it does, it's probably issue #3 (possibly issue #2 as a subset). If not, then it's probably issue #1.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  6. #5
    Junior Member
    Join Date
    Sep 2014
    Posts
    4
    Member #
    40259
    Thanks again so much for the help! I'm an idiot..... totally forgot to close the <input> tag in question. I did close it, and also tried ending the input tag with " />" but still no worky. Here's what I currently have after modifying it:

    HTML Code:
    <input type="hidden" name="LEADCF17" value="<?php echo $_SERVER['REMOTE_ADDR']; ?>" /></input>
    I then changed it to this, just to test the field, and "my ip" showed up in the correct field on my CRM:

    HTML Code:
    <input type="hidden" name="LEADCF17" value="my ip" /></input>
    It seems like something with the PHP isn't working. And my host (Hostgator) definitely supports PHP. Any other thoughts?

  7. #6
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    As much as I hate HostGator, you're right...this isn't on them.

    I filled the form out as well. If it worked, you should see an IP beginning with 99.229 (mine). The PHP end of it is working...I see my IP there. It sounds like you have an unrelated problem, possibly with your ISP or possibly with a firewall, piece of blocking software, or possibly a setting in your browser that doesn't allow for tracking. I'm not really a PHP expert, though.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  8. #7
    Junior Member
    Join Date
    Sep 2014
    Posts
    4
    Member #
    40259
    Quote Originally Posted by TheGAME1264 View Post
    As much as I hate HostGator, you're right...this isn't on them.

    I filled the form out as well. If it worked, you should see an IP beginning with 99.229 (mine). The PHP end of it is working...I see my IP there. It sounds like you have an unrelated problem, possibly with your ISP or possibly with a firewall, piece of blocking software, or possibly a setting in your browser that doesn't allow for tracking. I'm not really a PHP expert, though.
    I just got an e-mail advising me of my new lead

    Haha... I saw the e-mail and then saw the name of the client and realized immediately who it was. I then went into the CRM, and sure enough, your IP address is in there! Must be our proxy at work, but I tried with my smart phone that was NOT on Wi-Fi while at work and it also didn't give me an IP earlier. But I did see the 99.229.XX.XX IP for your form submission, so if it worked for you it should work for others.

    I tremendously appreciate your assistance with this!! Had it not been for you noticing I didn't even close my <input> tag, I probably would have fought it for days before realizing that!

    -Andrew

  9. #8
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    Awesome. Glad it worked out. Good luck, man.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)


Remove Ads

Posting Permissions

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

Search tags for this page

anything

,

web form capture ip address

Click on a term to search for related topics.

Tags for this Thread

All times are GMT -6. The time now is 04:36 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com