I'm newbie of PHP. I have this input for add pultiple array into MySQL database.
<input name="image_url[]" id="ads" type="text" value="">
now, I need to check if not empty value send to database.
I check with empty() function but this not worked with name="image_url[]".
HTML :
<input name="image_url[]" id="upload" type="text" value="">
PHP code:
if(empty($_POST['image_url'])){
echo 'true';
} else {
echo 'false';
}
But always I see output : true. in default my input is blank/empty.
I check and remove [] from input name(name="image_url") and I see true output.
I think my problem is input array name.
how do fix this and check for empty value?!
in var_dump($_POST) I see this output:
["image_url"]=>
array(1) {
[0]=>
string(0) ""
}
Live DEMO : http://madenade.besaba.com/php/?action=editnews&id=10
NOTE: check in demo with empty value and not empty value! u see output : false
empty