hello,
I've developed this simple piece of script for my client so she can easy add news to her homepage from the admin Panel, I would like some advice on how i would go about adding some formatting options to the content in the textfield be, like bold, italic and linking tags etc.
<html><head><title>Add News</title></head>
<body>
<form action="" method="get">
<textarea name="newscontent"></textarea>
<br><br>
<input type="submit" name="Submit" value="Add"></form>
</body>
</html>
<?php
$Submit = $_GET['Submit'];
if(isset( $Submit )) {
$post = $_GET['newscontent'];
$post = ereg_replace('[^A-Za-z 0-9,./?><";:\~!\'\"\/@#[](){}]', "", $post);
#news filename
$filename = "news.txt";
#open news file for reading
$fp = fopen($filename,"r+");
#read news file
$old_data = fread($fp, 80000);
fclose($fp);
$date = (date ("l - d F Y"));
$input = "<p align=\"left\">$date<br><b>$post</b><br></p>";
$new = "$input$old_data";
#open news file for writing
$fp = fopen( $filename,"w");
if(!$fp)
die("Failed to write!");
#write to news file
fwrite($fp, $new, 800000);
fclose( $fp );
#show success message
echo("Your News was Successfully Added!");
}
?>