I'm using the HTML attribute dataset with a select list.
<input type="text" name="productcode[]" id="productcode" class="productcode" list="products">
<datalist id="products">
<?php
$query=mysql_query("
SELECT * FROM dbProducts ORDER BY product_name");
while($entry=mysql_fetch_array($query))
{
echo '<option value="' . $entry['product_code']'">' . $entry['product_name'] . '</option>';
} ?>
</datalist>
As you can see the option value is different to the displayed text. If I was using <select>
I could pass the value into a form whilst only showing the text I want. Is there a way of doing this with <datalist>
? At the moment my form returns the input type with the product_code and product_name values.