In the above code I am trying to capture the value of idnum in the variable $image_result to no avail. Any help would be greatly appreciated
echo "<select name='myitem' id='myitem' action='post>";
while($row = mysql_fetch_array($result1)){
echo "<option value='".$row["idnum"]."' data-image='/components/com_aclsfgpl/photos/p".$row["idnum"]."n1.jpg'>".$row["title"]."</option>";
}
echo "<option value='". $row['idnum']."'>".$row['title']. '</option>';
echo "</select>";
$image_result=$_POST['myitem'];
A basic example of how you can capture the values from the dropdown, including the
data
attributes. The original was not valid - the select element does not have anaction
attribute - that belongs to the form - of which there is no sign. If you were to use this method it is trivial to then POST this data to another script/page as required or work withit in the same page with javascript.