I have a small form generated from a function:
which works just fine. But when i try something like this, error (Parse error: syntax error, unexpected $end in C:\AppServ\www\ pv5\wana\fn_lis t.php on line 89) is generated:
How can i use <<< notation in this form? I don't want to echo the output but instead hold it within a variable $form. Is storing html form within string - like this:
the only way to go?
Code:
$form=<<<EOD
<form action="index.php" method="POST" enctype="multipart/form-data" name="addform">
<table id="contenttable" cellspacing="0">
<tr><td class="error">{$errmsg}</td></tr>
<tr class="firstrow"><td> Title</td><td><input type="text" size="50" name="ctitle" maxlength="150" value="{$_POST[ctitle]}"></td></tr>
<input type="submit" class="buttons" name="go" value="Check"></td></tr>
</table>
</form>
EOD;
return $form;
Code:
function ListTitles(){
$sql="SELECT title FROM nletters";
$query=mysql_query($sql);
$ttlfound=mysql_num_rows($query);
mysql_free_result($query);
if($ttlfound=="0"){
return "No letters matching your critrea found.";
}//if $ttlfound
else{//at least one news found.
//build the table now.
$form=<<<EOD
EOD;
}//close at least one title found.
return $form;
}
Code:
$form="<table><tr><td><b>$title</b></td></tr></table>"
Comment