I have a textarea box that takes barcodes separated by a new line. When they are processed, the new lines become commas. But if somebody inputs:
123456
234567
...
with a bunch of spaces under each code as such, it then becomes
$barcode_list = 123456,,,234567
I am able to strip the commas from the end, and I have tried:
$array = explode(",", $barcode_list);
foreach($array as $item){ //Separate each item
if ($item == "") {
unset($item);
}
but it doens't seem to work, I still get mysqli errors etc. Is there any way to get around this?