Jump to content

Text feilds...


Lee-Bartlett

Recommended Posts

I have 2 text feilds which show the longitude and latitude of a map. Its a pain to copy and paste and put them in the form which updates my db, how would i do this. the 2 text feilds have text in, when button is pressed it takes me to the form and then puts that information in.

 

Any help would be appreciated, i dont expect answers, as i havn't attempted to do it yet but i dont know where to start

Link to comment
https://forums.phpfreaks.com/topic/130022-text-feilds/
Share on other sites

I think I understand what you mean. You can do something like the following...

<?php

if(isset($_POST['lat']) && isset($_POST['long'])) {
mysql_query("UPDATE `table` SET `lat`='".$_POST['lat']."',`long`='".$_POST['long']."' WHERE `something` = 'something'") or die("Query Error! ".mysql_error());
echo "Query was successful";
} else {
echo <<<_FORM
<form action="thispage.php" method="post">
Input Longitude
<input type="text" name="long" />
Input Latitude
<input type="text" name="lat" />
<input type='submit' />
</form>
_FORM;
}

?>

 

start off with that.

Link to comment
https://forums.phpfreaks.com/topic/130022-text-feilds/#findComment-674140
Share on other sites

I under stand that kind of but i dont think the select statment will work with it, im not grabing any varibles im grabbing a piece of this code i think. I didnt write the map code but maybe your understand more if you see the whole page.

 

    	


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
  <head>
    <style type="text/css">
    v\:* {
      behavior:url(#default#VML);
    }
    </style>
  <script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAgnVrcDn5i-V_BsqvXy3j8RRle8Rt1EK93-n5qGMjk9aCuGqlpBQ2sCqItCc79KzQksp90dVmLGk45w"  type="text/javascript"></script>
  </head>

  <body>

    <table width="223" border="0">
      <tr>
        <td width="217"><p>Double left click to zoom in.<br />
        Double right click to zoom out.</p>
        </td>
      </tr>
    </table>
    <div id="map" style="width: 600px; height: 400px"></div>
<div style="width: 600px;">
  <script type="text/javascript">//<![CDATA[

    var map = new GMap(document.getElementById("map"));
    map.centerAndZoom(new GPoint(-92.27722, 34.74875), 4);

   // var point = new GPoint(-92.27722, 34.74875);
   // var marker = new GMarker(point);
   // map.addOverlay(marker);

    //GEvent.addListener(map, 'click', function(overlay, point) {

     //   if (overlay) {
     //       map.removeOverlay(overlay);
//
   //   } else if (point) {

       //     map.recenterOrPanToLatLng(point);
       //     var marker = new GMarker(point);
       //     map.addOverlay(marker);
           //var message = "<HTML><HEAD></HEAD><BODY><FORM><b>Lat</b>: <INPUT TYPE='TEXT' SIZE='12' ID='latbox' VALUE=''><b>Lon</b>:<INPUT TYPE='TEXT' ID='lonbox'  SIZE='12' VALUE=''></FORM><br><br><br><br></BODY></HTML>"; 
          //  marker.openInfoWindowHtml(message);

     //}

     //});

// Recenter Map and add Coords by clicking the map
GEvent.addListener(map, 'click', function(overlay, point) {
            document.getElementById("latbox").value=point.y;
            document.getElementById("lonbox").value=point.x;
});
    //]]>
    </script>
</div>
  <table><table>
    <form>
      <tr>
        <td align="left"> Lat: </td>
        <td><input size=13 type="TEXT" id="latbox" name="lat" value="" /></td>
      </tr>
      <tr>
        <td align="left">Lon: </td>
        <td><input size=13 type="TEXT" id="lonbox" name="lon" value="" /></td>
      </tr>
      <tr>
        <td colspan="2" align="left"> Click map to get coordinates</td>
        </tr>
    </form>
  </table>
    </TABLE>
  <table cellpadding="10">
<tr>
<td>
<a href="userform.php">Submit a WIFI hotspot</a></td>
<td><a href="http://nexodom.com/website/wifi.php">Back to database</a></td></tr>
</table>
  </body>
</html>
<br>


</td></tr></table>

   
<!-- Start of StatCounter Code -->
<script type="text/javascript" language="javascript">
var sc_project=796901; 
var sc_partition=6; 
var sc_security="573b1ff4"; 
var sc_invisible=1; 
</script>

<script type="text/javascript" language="javascript" src="http://www.statcounter.com/counter/counter.js"></script><noscript><a href="http://www.statcounter.com/" target="_blank"><img  src="http://c7.statcounter.com/counter.php?sc_project=796901&java=0&security=573b1ff4&invisible=1" alt="invisible hit counter" border="0"></a> </noscript>
<!-- End of StatCounter Code -->



Link to comment
https://forums.phpfreaks.com/topic/130022-text-feilds/#findComment-674335
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.