Here is the string that is being used in this function example. Everything print except the option_block
// Vendor string $vendor_string .= <<<EOVS $header_string <tr> <td colspan="4"><br> <br> <form method="POST" name="insert_url" action="week6.php?view=vendorq"> Select the vendor of your choice: <SELECT NAME="vendor2"> $option_block; </SELECT> <input type="hidden" name="vendor_select" value="v"> <INPUT TYPE="Submit" NAME="Submit" Value="Submit"> </FORM> EOVS; -----Original Message----- From: Kevin Stone [mailto:[EMAIL PROTECTED]] Sent: Friday, February 14, 2003 6:41 PM To: Php-General Subject: Re: [PHP] function problem Exactly where does $option_block get put into $string? -Kevin ----- Original Message ----- From: "Peter Gumbrell" <[EMAIL PROTECTED]> To: "Php-General" <[EMAIL PROTECTED]> Sent: Friday, February 14, 2003 4:11 PM Subject: [PHP] function problem > I have a function below which populates a select list, based on the query > string and the field name. It then prints a string: > > function populate_selects($query_name, $db_field, $link, $string) > { > $result = mysql_query($query_name, $link) or die ("Could not execute > query."); > while ($columns = mysql_fetch_array($result)) > { > $column = $columns[$db_field]; > global $option_block; > $option_block .= "<OPTION name='vendor1' > value=\"$column\">$column</OPTION>\n"; > } > print $string; > } > > Part of the string that is printed in $string is the $option_block which is > in the function. There seems to be some problem with scope here. I made the > $option_block variable global but it still won't print. I have tested that > the $column field is being populated and it is, so I believe that it must be > the $option_block part that isn't working. Does anyone have any suggestions? > > Peter Gumbrell > [EMAIL PROTECTED] > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php