这可能看起来很奇怪,但我可能不知道如何完成它。为了解释它,这是我的困境。我有一个页面,我命名为form1.php(仅用于测试),它有一个输入文本框和一个输入提交类型,它将重新定向到form4.html(这是HTML)。
以下是表单1的代码
<html>
<head>
<meta charset="utf-8">
<title>Testing of GPS</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">
<script>
$(function() {
$( ".datepicker" ).datepicker();
});
</script>
</head>
<body>
<center>
<form action="form4.html" method="POST" name="manualform">
<div style="border:solid;background:#B29393;height:50%;width:50%;margin-top:150px;">
<br/><br/><br/><br/><br/><br/><br/>
Mobile Number:<input type="text" name="platemobnum" id="platemobnum"/>
<br/><br/>
From:<input type="text" class="datepicker" id="from" name="from">
<br/><br/>
<input type="submit">
</div>
</form>
</center>
</body>
现在,我想要以这种形式(form1.php)发布我的数据的价值而不是form4.html但是在form2.php中,但是form1.php必须重定向到form4.html。
这是form2.php
<?php
try {
$db = new PDO($dsn, $username, $password);
$db->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
$sth = $db->query("SELECT * FROM locations where name = '$platemobnum' ");
$locations = $sth->fetchAll();
} catch (Exception $e) {
echo $e->getMessage();
}
这是我的表单4
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
//<![CDATA[
var map;
// Ban Jelačić Square - Center of Zagreb, Croatia
var center = new google.maps.LatLng(14.641667, 121.084167);
var geocoder = new google.maps.Geocoder();
var infowindow = new google.maps.InfoWindow();
function init() {
var mapOptions = {
zoom: 13,
center: center,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
var marker = new google.maps.Marker({
map: map,
position: center,
});
makeRequest('get_locations.php', function(data) {
var data = JSON.parse(data.responseText);
var bounds = new google.maps.LatLngBounds();
for (var i = 0; i < data.length; i++) {
displayLocation(data[i]);
}
});
bounds.extend(myLatLng);
// window.alert(infowindow);
}
map.fitBounds(bounds);
function makeRequest(url, callback) {
var request;
if (window.XMLHttpRequest) {
request = new XMLHttpRequest(); // IE7+, Firefox, Chrome, Opera, Safari
} else {
request = new ActiveXObject("Microsoft.XMLHTTP"); // IE6, IE5
}
request.onreadystatechange = function() {
if (request.readyState == 4 && request.status == 200) {
callback(request);
}
}
request.open("GET", url, true);
request.send();
}
function displayLocation(location) {
var content = '<div class="infoWindow"><strong>' + location.name + '</strong>'
+ '<br/>' + location.address
+ '<br/>' + location.description + '</div>';
if (parseInt(location.lat) == 0) {
geocoder.geocode( { 'address': location.address }, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location,
title: location.name
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.setContent(content);
infowindow.open(map,marker);
});
}
});
} else {
var position = new google.maps.LatLng(parseFloat(location.lat), parseFloat(location.lon));
var marker = new google.maps.Marker({
map: map,
position: position,
title: location.name
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.setContent(content);
infowindow.open(map,marker);
});
}
}
</script>
</head>
<body onload="init();">
<h1>LTFRB Monitoring System</h1>
<section id="sidebar">
<div id="directions_panel"></div>
</section>
<section id="main">
<div id="map_canvas" style="width: 70%; height: 500px;"></div>
</section>
</body>
是否有可能和Ik感谢任何人的预先帮助/.