我有一个注册表单,我使用脚本将位置转换为它的纬度和经度,我正在使用 lorenzsell / Geocoded-Autocomplete (https://github.com/lorenzsell/Geocoded-Autocomplete/blob/master/README )
它就像一个魅力,如果我填写地址,那么我的表单中带有 id filter_lat 和 filter_lng 的输入字段将填充正确的坐标。
所以我希望如果我将它发送到位于 register.php 中的注册表单,它会看到这些坐标。但它没有.. 其他所有内容都已定义,只有 filter_lat 和 filter_lng 没有。虽然这些是自动填写的,但这是否与它有关?
<form method="POST" action="register.php">
<table>
<tr>
<td>
Email: <br/><input type="email" name="email" class="focussed_input" size="15" /><br>
</td>
<td>
Password: <br/><input type="password" name="password" class="focussed_input" size="15" /><br />
</td>
</tr>
<tr>
<td>
Name:<br/><input type="text" name="name" class="focussed_input" size="15" /><br />
</td>
<td>
Age: <br/><input type="text" name="age" class="focussed_input" size="15" /><br />
</td>
</tr>
<tr>
<td>
Address:<br/><input type=text id="mapaddress" class="focussed_input" /><br/>
</td>
<td>
<input type="text" id="filter_lat" style="" />
<input type="text" id="filter_lng" style="" />
<input type="submit" value="I'm ready!" class="button_inverse" style="padding-left: 23px; padding-right:23px; margin-top:11px;" />
</td>
</tr>
</table>
</form>
这就是表格,以及 register.php 代码:
<?php
echo $_POST['filter_lat'];
echo "include";
include("config.php");
echo "test";
if(isset($_POST["email"])&& isset($_POST["password"]) && isset($_POST["name"]) && isset($_POST["age"])){
echo"na isset";
$email = htmlentities(mysql_real_escape_string($_POST['email']));
if(mysql_num_rows(mysql_query("SELECT * FROM users WHERE email ='$email';")) > 0){
echo "email already used";
}
else{
$password = hash('sha512', $salt . mysql_real_escape_string($_POST['password']));
$name = htmlentities(mysql_real_escape_string($_POST['name']));
$age = htmlentities(mysql_real_escape_string($_POST['age']));
$lat = htmlentities(mysql_real_escape_string($_POST['filter_lat']));
$lng = htmlentities(mysql_real_escape_string($_POST['filter_lng']));
$id = '';
mysql_query("INSERT INTO users (id, email, password, name, age, lat, lng, type) VALUES ('$id', '$email', '$password', '$name', '$age', '$lat', '$lng', '0');") or die(mysql_error());
echo "Account creation successful!";
}
}
?>
有人用过 lorenzsell 的自动填充器吗?或者有人知道如何解决这个问题?
提前致谢!