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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Javascript to pass values to php

  • 16-11-2011 8: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,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, Registered Users 2 Posts: 601 ✭✭✭honeymonster


    I am a retard!


Advertisement