I have a register form, and I use a script to transform a location to it’s latitude and longitude, I’m using lorenzsell / Geocoded-Autocomplete (https://github.com/lorenzsell/Geocoded-Autocomplete/blob/master/README)
It works like a charm, if I fill in the address, then the input fields in my form with the id
filter_lat and filter_lng are filled with the correct coordinates.
So I was hoping that if I send this to a register form located in register.php,
that it would see these coordinates. But it doesnt.. everything else is defined, only the filter_lat and filter_lng arent. though these are filled in automatically, does this have to do something with it?
<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>
that’s the form,
and the register.php code:
<?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!";
}
}
?>
anybody used lorenzsell’s autofiller before? or someone knows how to fix this issue?
Thanks in advance!
Change the id of filter_lat and filter_lng to name. It should look something like this –
You are retrieving data with $_POST at server side, but you can’t retrieve data without name. So basically, you were trying to retrieve data filter_lat which doesn’t exist.
Attribute id is mostly ment for CSS and javascript/jQuery