NitinMutkawoa Posted June 18, 2013 Share Posted June 18, 2013 hello.. i urgently need help concerning this page subjectgoogle.php - - to display the google maps togather with the table form: <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> <title>Saving User-Added Form Data Example</title> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> <script type="text/javascript"> var marker; var infowindow; function initialize() { var latlng = new google.maps.LatLng(37.4419, -122.1419); var options = { zoom: 13, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP } var map = new google.maps.Map(document.getElementById("map_canvas"), options); var html = "<table>" + "<tr><td>Criminal ID:</td> <td> <?php if ($subject == "criminal") { $sql_query= mysql_query("SELECT max(criminalid) + 1 from `criminal` "); $row1 = mysql_fetch_array($sql_query); //echo $row1[0]; //if $row ?><input type='text' id='id' value="<?php echo $row1[0];?>"/></td> </tr>" <?php } else if ($subject == "offender") { $sql_query1= mysql_query("SELECT max(offenderid) + 1 from `offender` "); $row = mysql_fetch_array($sql_query1); //echo $row[0]; ?> + "<input type='text' name='id' id='id' value ="<?php echo $row[0];?>"/>"+ <?php } ?> "<tr><td>Location ID:</td> <td><input type='text' id='locid'/></td> </tr>" + "<tr><td>First Name:</td> <td><input type='text' id='fname'/> </td> </tr>" + "<tr><td>Last Name:</td> <td><input type='text' id='lname'/></td> </tr>" + "<tr><td>Age:</td> <td><input type='text' id='age'/></td> </tr>" + "<tr><td>Address:</td> <td><input type='text' id='address'/></td> </tr>" + "<tr><td>Profession:</td> <td><input type='text' id='profession'/></td> </tr>" + "<tr><td>Modus Operandi:</td> <td><input type='text' id='modus_operandi'/></td> </tr>" + "<tr><td>Hiv Info:</td> <td><input type='text' id='hiv_info'/></td> </tr>" + "<tr><td> Subject:</td> <td><select id='subject'>" + "<option value='criminal' SELECTED>criminal</option>" + "<option value='offender'>offender</option>" + "</select><?php echo "<select name='subject' onchange=\"reload(this.form)\"><option value=''>select one</option>"; if($subject==@$subject) {echo "<option selected value= ".$subject."></option>"; echo "<option value='criminal'>criminal</option>"; echo "<option value='offender'>offender</option>";} else{echo "<option value=\"".$subject."\">".$subject."</option>";} ?> </td></tr>" + "<tr><td></td><td><input type='button' value='Save & Close' onclick='saveData()'/></td></tr>"; infowindow = new google.maps.InfoWindow({ content: html }); google.maps.event.addListener(map, "click", function(event) { marker = new google.maps.Marker({ position: event.latLng, map: map }); google.maps.event.addListener(marker, "click", function() { infowindow.open(map, marker); }); }); } function saveData() { var id = escape(document.getElementById("id").value); var locid = escape(document.getElementById("locid").value); var fname = escape(document.getElementById("fname").value); var lname = escape(document.getElementById("lname").value); var age = escape(document.getElementById("age").value); var address = escape(document.getElementById("address").value); var profession = escape(document.getElementById("profession").value); var modus_operandi = escape(document.getElementById("modus_operandi").value); var hiv_info = escape(document.getElementById("hiv_info").value); var subject = document.getElementById("subject").value; var latlng = marker.getPosition(); var url = "subjectgooglescript.php?id=" + id + "&locid=" + locid + "&fname=" + fname + "&lname=" + lname + "&age=" + age + "&address=" + address + "&profession=" + profession + "&modus_operandi=" + modus_operandi + "&hiv_info=" + hiv_info + "&lat=" + latlng.lat() + "&lng=" + latlng.lng(); downloadUrl(url, function(data, responseCode) { if (responseCode == 200 && data.length <= 1) { infowindow.close(); document.getElementById("message").innerHTML = "Location added."; } }); } function downloadUrl(url, callback) { var request = window.ActiveXObject ? new ActiveXObject('Microsoft.XMLHTTP') : new XMLHttpRequest; request.onreadystatechange = function() { if (request.readyState == 4) { request.onreadystatechange = doNothing; callback(request.responseText, request.status); } }; request.open('GET', url, true); request.send(null); } function doNothing() {} </script> </head> <body style="margin:0px; padding:0px;" onload="initialize()"> <div id="map_canvas" style="width: 500px; height: 300px"></div> <div id="message"></div> </body> </html> can you help in identifying my errors please?? regards Quote Link to comment Share on other sites More sharing options...
doddsey_65 Posted June 18, 2013 Share Posted June 18, 2013 Posting a big block of code and asking where the errors are is not going to get any reasonable answers. What errors are being shown to you? Quote Link to comment 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.