/notes

my notes for development, it may be useful sometimes when I forget something, so I try to look for it here if I already done it before.

notes

my notes for development, it may be useful sometimes when I forget something, so I try to look for it here if I already done it before.

PHP

empty

I encounted in <input type="number"> that even the field is empty, the empty() is not returning true;

I have found it in Stackoverflow.

$quantity = $_POST['quantity'];
foreach ($quantity as $key => $value) {
  if (empty($value)) {
     unset($quantity[$key]);
  }
}
if(!empty($quantity)){
  echo 'not empty';
} else {
  echo 'empty';
}

get form input array into PHP array

Stackoverflow