0

I'm trying to put some values into DB with PHP. I'm using polymer dart .

html

<form action="conexion.php" method="post">
<input type=hidden name="latitud" value="{{latitud}}">
<input type=hidden name="longitud" value="{{longitud}}">
<input type="submit" value="submit">
</form>

php

<?php 
$hostname_dasavi_codes = "xxx"; 
$database_dasavi_codes = "xxx"; 
$username_dasavi_codes = "xxx"; 
$password_dasavi_codes = "xxx"; 
$dasavi_codes = mysql_connect($hostname_dasavi_codes, $username_dasavi_codes, $password_dasavi_codes) or trigger_error(mysql_error(),E_USER_ERROR);  
$calle="rolf";
$lat=$_POST["latitud"];
$lon=$_POST["longitud"];
mysql_select_db($database_dasavi_codes, $dasavi_codes); 
$query_java = "INSERT INTO ovnis (latitud,longitud,calle) VALUES ('$lat','$lon','$calle')"; 
$result=mysql_query($query_java);
?> 

dart

...
  @published String latitud;
  @published String longitud;
...
Geoposition startPosition;
String calle;
window.navigator.geolocation.getCurrentPosition()
.then((Geoposition position) {
  startPosition = position;
  latitud="${startPosition.coords.latitude}";
  longitud="${startPosition.coords.longitude}";

is this code wrong? When i used it only put $calle but $Latitud, $longitud not pd :I create this new question because i can't answer my questions :) thx

Tomasz Kowalczyk
  • 10,472
  • 6
  • 52
  • 68
dasavi
  • 25
  • 4
  • This is not the code relevant for the question/problem you have. There is no code that shows how you send the data to the server. You probably don't receive data and therefor you only store the hardcoded `$call="rolf"` value and the empty `$lat`, `$lon` values. – Günter Zöchbauer Mar 20 '14 at 09:56
  • @GünterZöchbauer "There is no code that shows how you send the data to the server." - There is a HTML form with a submit button right at the beginning of the question. – MarioP Mar 20 '14 at 10:45
  • @user3439068 Have you verified the fields do receive their expected values before submitting the formular? – MarioP Mar 20 '14 at 10:46
  • @MarioP Thanks for the hint, I missed that completely. I thought because there is Polymer involved this has to be done by code. This might only be necessary when a part of the form (some fileds) are inside a polymer element and the form tag is outside of it (never used it myself yet). – Günter Zöchbauer Mar 20 '14 at 10:49
  • possible duplicate of [php and polymert dart](http://stackoverflow.com/questions/22528458/php-and-polymert-dart) – Günter Zöchbauer Mar 20 '14 at 10:53
  • This question has not additional info to your previous question. Why did you post this duplicate? Why did you want to answer to your previous question? – Günter Zöchbauer Mar 20 '14 at 10:55

0 Answers0