Hi all:
I am buidling a form inside heredoc. For part of the form, I need to build a drop down menu with data pulled from another table. I thought I could accomplish this by defining a function and the executing the function inside the heredoc string, but that didn't work (actually, it caused the echo statments inside the function to go ahead and echo right where they were instead of where the function was called). Then I tried to define a variable as the output of the function and I got the same result as above. Here is the code:
//define a function to get the who can go drop down menu
function who_options() {
$who_querydrop = "select who_can_go_id,who_desc from who_can_go";
$who_resultdrop = MYSQL_QUERY($who_querydrop);
$who_numberdrop = mysql_Numrows($who_resultdrop);
if ($who_numberdrop>0) {
$who_xdrop=0;
while ($who_xdrop<$who_numberdrop) {
$who_can_go_id = mysql_result($who_resultdrop,$who_xdrop,"who_can_go_id");
$who_desc = mysql_result($who_resultdrop,$who_xdrop,"who_desc");
echo "<option value=\"$who_can_go_id\">$who_desc</option>";
$who_xdrop++;
} // end while
} // end if
} //end function who options
and in the form I have tried:
<select name="who_can_go">
<option="">Select One
{${who_options()}}
and
{who_options()}
</select>
And of course, outside the form
$who_options= who_options();
Then just added $who options to the heredoc string.
I am lost, any help would be appreciated.
BTW - I know I can accomplish this by not putting the entire form in a variable string. but with my application, I think it is the right way to do it and it should be doable...