Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Javascript to pass values to php

  • 16-11-2011 09:29PM
    #1
    Registered Users, Registered Users 2 Posts: 601 ✭✭✭


    Hi

    I have the following code:

    [HTML]function updateMarkerPosition(latlng)
    {
    document.getElementById('t1').value=latlng.lat();
    document.getElementById('t2').value=latlng.lng();
    } [/HTML]

    It displays a value in these text boxes

    [HTML] <input type="text" id="t1" name="t1" value="">
    <input type="text" id="t2" name="t2" value="">[/HTML]

    The boxes are part of google maps. They store the lat and long of a marker.
    The problem I'm having is javascript appears to be only displaying the values. When I view the source it still says value="" for both fields.

    What would be the best way to get the lat lng values from javascript into a php variable to be stored in a db?


Comments

  • Closed Accounts Posts: 7,144 ✭✭✭DonkeyStyle \o/


    Viewing the page source is exactly that... source. It's not a live dump of the DOM as it exists at any point in time.
    Just submit the form to php, the javascript-filled form fields should pass those values normally.


  • Registered Users, Registered Users 2 Posts: 601 ✭✭✭honeymonster


    I am a retard!


Advertisement