deruiter2 Posted October 24, 2011 Share Posted October 24, 2011 hello, I'm making an app with the google api and php that will locate your location and send this via twitter. Now I want the location being send using a form like this: <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"> </script> <script type="text/javascript" src="http://code.google.com/apis/gears/gears_init.js"></script> <script type="text/javascript"> var geocoder; var initialLocation; var browserSupportFlag = new Boolean(); var infowindow = new google.maps.InfoWindow() function initialize() { geocoder = new google.maps.Geocoder(); // Opties voor de kaart, de coordinaten worden het middelpunt var myOptions = { zoom: 18, mapTypeId: google.maps.MapTypeId.HYBRID }; // Maak een nieuwe kaart aan met de ingestelde opties var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); //W3C Geolocation if(navigator.geolocation) { browserSupportFlag = true; navigator.geolocation.getCurrentPosition(function(position) { initialLocation = new google.maps.LatLng(position.coords.latitude,position.coords.longitude); map.setCenter(initialLocation); // instellen van de marker var marker = new google.maps.Marker({ position: (initialLocation), map: map, title:"Uw positie", }); document.getElementById('test').innerHTML = initialLocation; }, function() { handleNoGeolocation(browserSupportFlag); }); The var initialLocation is the var holding the location. I'm sending this via a form to a new php document. <form action="Map3.php" method="post"> <div id="naam"> Voornaam: <input name="Naamveld" type="text" /><br /></div> <div id="lidmaatschap">Lidmaatschapnummer: <input name="Lidveld" type="text" /><br /></div> <div id="kenteken">Kenteken: <input name="Kentekenveld" type="text" /><br /></div> <div id="telefoon">Telefoonnummer: <input name="Telefoonveld" type="text" /><br /></div> <center><div id="adres">Uw Coördinaten:</div></center> <center><div id="test"><input name="geg" id="test"/></div></center> <center><input name="Send" type="submit" /></center> </form> The next page calls the information from this form and sends this to twitter, <a href="https://twitter.com/share" class="twitter-share-button" data-text="N: <?php echo $_POST["Naamveld"];?> -- Lid: <?php echo $_POST["Lidveld"]; ?> -- Ken: <?php echo $_POST["Kentekenveld"]; ?> -- Tel: <?php echo $_POST["Telefoonveld"];?> -- adres: <?php echo $_POST["geg"]; ?>" data-count="none" data-via="ANWBtester" data-lang="nl">Tweeten</a><script type="text/javascript" src="//platform.twitter.com/widgets.js"></script> The only problem is that he gets everything from the form into the tweet accept the location. Could anyone help me? Quote Link to comment https://forums.phpfreaks.com/topic/249725-using-innerhtml-for-form-and-php/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.