JustMatthew JustMatthew - 1 year ago 53
PHP Question

How to convert a php variable into a string(From <form:input>), to send lat, and long?

I have this code below. The $address variable must get a string, in order to convert, and send it to a database. I have a form with inputs, which I store in further variables. How should i convert the values to get lat and long?

$address = "Rákoscsaba, Nagyréde utca 8. 1172"; // Google HQ
$prepAddr = str_replace(' ','+',$address);
$output= json_decode($geocode);
$lat = $output->results[0]->geometry->location->lat;
$long = $output->results[0]->geometry->location->lng;

It s working... the 3 variables I want to use: $user_telepules, $user_utca', $user_irsz

I've already tried these ways:

$address =['user_telepules'].','.['user_utca'].['user_irsz'];
$address =(string)$user_telepules.','.(string)$user_utca.(string)$user_irsz;

Answer Source

Ok, now I get it. Show us few data samples from this three variables. Maybe there is problem with something else, not string format.

How are you passing variables from input? Have you checked, if they actually exist and pass inputs from form?

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download