www.webdeveloper.com
Results 1 to 2 of 2

Thread: Insert GeoIP City into html form

  1. #1
    Join Date
    Feb 2013
    Posts
    1

    Insert GeoIP City into html form

    Searched and couldn't find an answer on this one. I am not much of a coder and know very little about javascript. Hoping someone here can help me out. I need to get the user's geoip city and then insert it as a value into a form. I have this script for getting the geoip city...

    <script src="http://j.maxmind.com/app/geoip.js"></script><script type="text/javascript">document.write(geoip_city());</script>

    I need that city to be put into the value part of the form

    <input type="hidden" name="city" value="NEED CITY INSERTED HERE"></input>

    Any ideas on how to do this?

  2. #2
    Join Date
    Feb 2013
    Posts
    1
    PHP Code:
    <!DOCTYPE HTML>
    <
    html>
    <
    head>
    <
    meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <
    title</title>
    </
    head>
    <
    body>
    <
    input type="text" name="city"></input>
    <
    script src="http://j.maxmind.com/app/geoip.js"></script>
    <script type="text/javascript">
    document.getElementByName('city').value =  geoip_city();
    </script>
    </body>
    </html> 

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles