So what I'm trying to do is add a name='' value to an option in a drop down list. This all is pretty simple using just HTML. But I would like to have the name value be from the database I'm queuing. But the database string has spaces in between the words, and this causes a problem. I need the string to be Eten & drinken and not the way it outputs now, see example below.
Right now, I've got this:
<?php $q = $row["Categorie"];
echo "
<option value=".$q." name=".$q.">
".$row["Categorie"]."
<span style='font-size:1.2rem;color:#F8F8F8;'>(" . $row['x'] . ")
</span>
</option>
";?>
Which outputs the following if I look at the source:
<option value="eten-en-drinken" name="Eten" &="" drinken="">
Eten & drinken (19)
</option>
I've tried searching google and str_replace, htmlspecialchars, utf8_encode and changed name to data-type but noting works. I just want it to be Eten en drinken. I need this exact value for use in a second drop down menu. Any thoughts, documentation or help?
$q = $row["Categorie"];$row'sare shown correct and the data is queued, only thename=''part is the problem here.$stubvalue was the same as the name value. So I changed that, hope this is better and clearer.