Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Javascript to pass values to php

Options
  • 16-11-2011 9:29pm
    #1
    Registered Users 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,145 ✭✭✭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 Posts: 601 ✭✭✭honeymonster


    I am a retard!


Advertisement