Im having trouble with this php mysql issue. I have 5 input fields with the same name, and foreach input field entered i was that to be saved in the database. But at the moment, if i input 2 fields, its inserting them plus 3 blank ones. How do i just insert the ones which are not empty
here is the html
<input type="text" name="tags[]" placeholder="Add Tags" />
<input type="text" name="tags[]" placeholder="Add Tags" />
<input type="text" name="tags[]" placeholder="Add Tags" />
<input type="text" name="tags[]" placeholder="Add Tags" />
<input type="text" name="tags[]" placeholder="Add Tags" />
here is the php
$tags = $_POST['tags'];
for($i = 0; $i < count($tags); $i++){
$tag = $_POST['tags'][$i];
$addtags = $gifs->addtags($tag, $id);
}