Need help regarding post function..
Posted: Fri Feb 11, 2011 11:07 am
hi...i am posting my gps postion frm my mobile to this php.....
this script is working absolutely fine....it is writing what ever i posted from my mobile to textfile..
but i could not echo or use the variables $latitude and $longitude...........pls help
Code: Select all
<?php
$filename = 'textfile.txt';
// Open a file for appending
$handle = fopen($filename, 'a+');
// Get the data from the POST request
$latitude = $_POST['lat'];
$longitude = $_POST['lon'];
// PHP recommends writing the exact data length
fwrite($handle, $latitude, strlen($latitude));
fwrite($handle, $longitude, strlen($longitude));
//Append a newline
fwrite($handle, "\n");
//close the file
fclose($handle);
?>this script is working absolutely fine....it is writing what ever i posted from my mobile to textfile..
but i could not echo or use the variables $latitude and $longitude...........pls help