I am working with a html select dropdown list <select></select> in php. I can create my dropdown lists fine as long as they hold just a single value but i am struggling to create the dropdown list if i need a value and a display value, where the value needs to be the id of a hospital and the display value being the hospital name. I am fairly new to php and feel the solution here is just out of my grasp. What i need is below result seen in image 2 but when hospital name is selected it is actualu storing the hospital id. Can someone please assist.....many thanks
...foreach($records as $record)
{
$dataValues[] = $record->getField('hospitalId');
$dataValues[] = $record->getField('hospitalName');
}
foreach($dataValues as $vl)
{
$output .= '<option value="' . $vl[0] . '">' . $vl[1] . '</option>';
}
echo $output;...

$vl[0]and$vl[1]instead?