I understand that calling PHP functions within HEREDOC strings can be tricky and I have looked at some of the previous answers on here and tried to implement them without success.
I have a function that outputs enum data type to a drop-down list using the <select> tag. The code works well when not using HEREDOC strings.
However I would like to get this working within the HEREDOC delimiter but I am having an issue calling the function and getting the output into the dropdown.
Any steering would be appreciated.
function show_enum_in_dropdownbox() {
$query = query("SHOW COLUMNS FROM members_personal_details WHERE Field = 'enum_region'");
while ($row = mysqli_fetch_row($query)) {
foreach(explode("','",substr($row[1],6,-2)) as $option) {
print("<option>$option</option>");
} // ends foreach
} // ends while loop
} // ends function
Heredoc
$myenums = <<<DELIMETER
<select name="region" id="" class="form-control" style="min-width: 100%; max-height: 200px;" required>
<option value="">PLEASE SELECT REGION</option>
<?php show_enum_in_dropdownbox(); ?>
</select>
DELIMETER;
echo $myenums;