Hello,
I have a comment box that uses php her is the code:
<?php
$act = $_POST['act'];
if($act == "post") {
$name = $_POST
['name'];
$area = $_POST ['area'];
@$fp = fopen("comments.html", 'a');
if (!$fp) {
//The file could not be opened
echo "There was an error! Please try again later!";
exit;
} else {
//The file was successfully opened, lets write the comment to it.
date_default_timezone_set('Europe/London');
setlocale (LC_ALL, "en_GB");
$outputstring = "<p class=three><b>" .$name. " </b> on ".strftime('%A %e %B %Y ')." at ".strftime('%H:%M')." GMT wrote:</br></br> " .$area. "</p>" ;
//Write to the file
fwrite($fp, $outputstring, strlen($outputstring));
//We are finished writing, close the file for security / memory management purposes
fclose($fp);
//Post the success message
header('Location: article1.php');
}
} else {
//We are not trying to post a comment, show the form.
?>
<p class=three>Comments:</p>
<?php include("comments.html"); ?>
<div id="shadow">
Send a comment:
<form action="article1.php" method="post">
<table>
<tr>
<td>Name:</td>
<td><input type="text" name="name" style="font-family:arial; font-size = 12pt" size="60" value="anonymous"></input></td>
</tr>
<tr>
<td>Comment:</td>
<td>
<textarea name="area" style="font-family:arial; font-size = 12pt" rows = "8" cols = "48" wrap="hard">\n\n</textarea><br>
</td>
</tr>
</table>
<input type="hidden" name="act" value="post"></input>
<input type="submit" name="submit" value="submit"></input>
</form>
</p>
</div>
<?php
}
?>
</div>
When i submit my text that i showed like this in the textarea:
This
is
a
test
comment!
I get this:
This is a test comment!
I can solve this by putting the </br> tag but people that d'ont know html cant how can i put a </br> automaticly?
sanchixx