I'm quite baffled by this. I have the following code in a php script, everything works fine except the description field. As you can see in the output in the Advanced REST client the description field is not set. I do not understand why something like this would be happening :
if (isset($_POST['latitude']) && $_POST['longitude'] && $_POST['image'] && $_POST['user'] && $_POST['description'] != '') {
// get tag
$latitude= $_POST['latitude'];
$longitude= $_POST['longitude'];
$image = $_POST['image'];
$user = $_POST['user'];
$description= $POST['description'];
$min = 10000.0;
$uuid = random_str(32,'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ');
echo $latitude;
echo "BREAK";
echo $longitude;
echo "BREAK";
echo $image;
echo "BREAK";
echo $user;
echo "BREAK";
echo $description;
echo "BREAK";
Two really important things:-
1.$description= $POST['description'];
needs to be $description= $_POST['description'];
_
missed by you
2.if
condition need to be changed like below:-
if (isset($_POST['latitude']) && isset($_POST['longitude']) && isset($_POST['image']) && isset($_POST['user']) && isset($_POST['description'])) {
Note:- && $_POST['longitude']
and so on others in your if
will not do anything so useless. Since isset()
check that a variable is set and have some value or not so use it for all $_POST
variables.
Your code has syntax error, Replace $POST
with $_POST
You're calling variable $POST
instead of $_POST
.
You should write:
$description = $_POST['description'];