How do I get this php statement that gets all the values from database and outputs as checkboxes to
- by ggfan
I am a bit lost in all these "" and '' and . in this statement.
Basically this query is to get all the tagname from table "tag" and display them for the users as checkboxes. If they have clicked 'submit' and they missed another field(say the title of a post), it would still have the tag they chose displayed. The part I need help with is the echoing part. It doesn't seem to remember the tag when they click submit.
$query4 = "SELECT * FROM tags ORDER BY tagname";
$data4 = mysqli_query($dbc, $query4);
while ($row4 = mysqli_fetch_array($data4))
{
echo "<li><input type='checkbox' name='postingtag[]'";
if (!empty($postingtag)){
echo "value='$postingtag'";
}
else{
echo "value='{$row4['tagID']}'";
}
echo ">{$row4['tagname']}</li>";
}