HereDoc not working properly
Posted: Fri Jan 09, 2004 4:44 pm
Hello,
The following code will not print to the browser using a variable to hold it until returning it from a function. It will output if I use print instead of a variable.
I'm trying not to print directly from a function as a practice.
The weird thing is, this method works fine in other functions in the same file. This problem started with the last function I wrote. The code was cut and pasted from earlier functions, but I don't see why that should matter. When I view LF's they look the same as the functions that work. I'm stumped.
TIA,
- D
The following code will not print to the browser using a variable to hold it until returning it from a function. It will output if I use print instead of a variable.
I'm trying not to print directly from a function as a practice.
The weird thing is, this method works fine in other functions in the same file. This problem started with the last function I wrote. The code was cut and pasted from earlier functions, but I don't see why that should matter. When I view LF's they look the same as the functions that work. I'm stumped.
TIA,
- D
Code: Select all
$htmlout = <<<HTML
<h2>Accounts: Insert Record</h2>
<h3>$db_cust_company: $db_cust_fname $db_cust_lname</h3>
<form name="frm_accounts" action="$page" method="POST">
<input type="hidden" name="view" value="acc_insert" />
<input type="hidden" name="cust_id" value="$cust_id" />
<table id="ns_input">
<tr><td class="right" nowrap="1">Webmaster email:</td><td class="field">
<input type="text" size="40" name="acc_webmaster_email" value="acc_webmaster_email /></td></tr>
<tr><td class="right">Domain name:</td><td class="field"><input type="text" size="40" name="dom_name" value="dom_name" /></td></tr>
<tr><td class="right">Hostname:</td><td class="field"><input type="text" size="40" name="acc_hostname" /></td></tr>
<tr><td class="right">Username:</td><td class="field"><input type="text" size="40" name="acc_username" /></td></tr>
<tr><td class="right">Password:</td><td class="field"><input type="text" size="40" name="acc_password" /></td></tr>
<tr><td class="right">IP address:</td><td class="field"><input type="text" size="40" name="dom_ip" /></td></tr>
<tr><td class="right" nowrap="nowrap">Primary Nameserver:</td>
<td class="field">
HTML;
$sql = "SELECT * FROM nameservers";
$results = mysql_query($sql, $dblink);
$htmlout .= "<select name="prim_ns_id" size="1">\n";
while($rows = mysql_fetch_assoc($results))
{
$db_ns_id = $rowsї'ns_id'];
$db_ns_name = $rowsї'ns_name'];
$db_ns_ip = $rowsї'ns_ip'];
$htmlout .= "<option value="$db_ns_id">$db_ns_name</option>\n";
}
$htmlout .= "</select>\n</td></tr>";
$htmlout .= "<tr><td class="right" nowrap=\nowrap">Secondary Nameserver:</td><td>\n";
$htmlout .= "<select name="sec_ns_id">\n";
$sql = "SELECT * FROM nameservers";
$results = mysql_query($sql, $dblink);
while($rows = mysql_fetch_assoc($results))
{
$db_ns_id = $rowsї'ns_id'];
$db_ns_name = $rowsї'ns_name'];
$db_ns_ip = $rowsї'ns_ip'];
$htmlout .= "<option value="$db_ns_id">$db_ns_name</option>\n";
}
$htmlout .= "</select>\n</td></tr>";
$htmlout .= <<<HTML2
<tr><td class="right">POP incoming email::</td><td class="field"><input type="text" name="acc_pop" size="40" /></td></tr>
<tr><td class="right">SMTP outgoing email:</td><td class="field"><input type="text" name="acc_smtp" size="40" /></td></tr>
<tr><td class="right">Frontpage:</td><td class="field"><input type="checkbox" name="acc_frontpage" value="1" /></td></tr>
<tr><td class="right">Autoresponder:</td><td class="field"><input type="checkbox" name="acc_autoresp" value="1" /></td></tr>
<tr><td class="right">Database:</td><td class="field"><input type="checkbox" name="acc_database" value="1" /></td></tr>
<tr><td class="right">SSL:</td><td class="field"><input type="checkbox" name="acc_ssl" value="1" /></td></tr>
<tr><td class="right">Email-filter:</td><td class="field"><input type="checkbox" name="acc_email_filter" value="1" /></td></tr>
<tr><td class="rightT">Notes:</td><td class="field"><textarea cols="45" rows="15" name="acc_notes"></textarea></td></tr>
<tr><td class="center" colspan=2><input type="submit" class="submit" value="Insert Record"></td></tr>
</table>
HTML2;
return $htmlout;