Joined
·
648 Posts
The title isn't very descriptive, or accurate, so I will try to explain.
I'm not all that good at PHP so i'm trying to do things with the limited skill/knowledge I have.
I've created a file called directorate.php and I am trying to write both HTML AND user entered values to it. I have included the file on a page so the idea is for the Directors/CEO to be able to post notes. I will post some code to hopefully make more sense...
In my view, which is probably wrong, this says "Write > HTML Start > User entered title > HTML Middle > User entered body (message) > HTML end.
It doesn't work and brings up junk characters and doesn't add all the HTML.
What's a better (or working) way to add HTML + User values to a document?
Thanks in advance
I'm not all that good at PHP so i'm trying to do things with the limited skill/knowledge I have.
I've created a file called directorate.php and I am trying to write both HTML AND user entered values to it. I have included the file on a page so the idea is for the Directors/CEO to be able to post notes. I will post some code to hopefully make more sense...
PHP:
<?
$fn = "/home/vortex/public_html/news/bullet/directorate.php";
$title = stripslashes($_POST['mtitle']);
$body = stripslashes($_POST['mbody']);
$fp = fopen($fn,"r+") or die ("Error opening file in write mode!");
$htmlstart = "[TABLE][TR]\n[TD][IMG]img/lb_dec.jpg[/IMG][/TD] [TD]\n";
$htmlmiddle = "[/TD][TD]
[/TD][/TR][/TABLE]\n[TABLE]\n[TR][TD]
[TABLE][TR][TD]
";
$htmlend = "
[/TD][/TR][/TABLE]
[/TD][/TR][/TABLE]";
fwrite($fp, $htmlstart + $title + $htmlmiddle + $body + $htmlend);
fclose($fp) or die ("Error closing file!");
echo "";
echo "\n";
?>
It doesn't work and brings up junk characters and doesn't add all the HTML.
What's a better (or working) way to add HTML + User values to a document?
Thanks in advance