Hi, I have a collection of PHP scripts that allow for text to be appended to an existing file by the user entering in the appended details into a text box. However, I would like it so that they cannot enter in blank spaces or so that they cannot just leave the text box blank, and I was wondering how this could be done by using the trim function. This is my appending file PHP script:

Code:
<!--Here, I am starting a PHP script-->
<?php
//An if statement is being used here so that if the contents of the text box in the form below that is called append is not null/empty, then this branch will run
if($_POST['append'] !=null)
{
//Here, I am creating a variable called filename and am assiging it a value of the file path to a file called denman2.txt
$filename="C:/xampp/htdocs/rcm/denman2.txt";
//Here, I am creating a variable called file, and am assiging it a value of the fopen keyword that is appending (as shown by the "a" argument) to the value associated with the filename variable 
$file=fopen($filename, "a");
//Here, I am creating a variable called msg that is essentially the formatted string that will display "Updated Information:" and then get the text that was entered into the text box field called "append" in the form. The fputs variable is then used to append this formatted string to the file associated with the filename variable
$msg="<p>Updated Information: " .$_POST['append']. "</p><br>";
fputs ($file, $msg);
//Here, I am using the fclose command to close the value associated with the file variable
fclose($file);
}
//Here, I am ending the PHP script
?>
Any help is appreciated!