Hi all, I have my guestbook working as I wish, all bar one thing:
If anyone inserts a continual line such as "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
The page breaks, in order to stop this I have used the following code:
However this leaves me with odd looking sentences E.G
Therefore I was just wondering if anyone would be able to help me create a piece of code that would prevent the page from breaking, but not cause me to have random spaces in messages?
Thanks all,
Jcb33.
If anyone inserts a continual line such as "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
The page breaks, in order to stop this I have used the following code:
Code:
<?php
}
else
{
// get all guestbook entries
while($row = mysql_fetch_array($result))
{
// list() is a convenient way of assign a list of variables
// from an array values
list($id, $user, $title, $message, $date) = $row;
// change all HTML special characters,
// to prevent some nasty code injection
$title = htmlspecialchars($title);
$user = htmlspecialchars($user);
$message = htmlspecialchars($message);
//Adds Spacing To Stop Page Breaking
$title = chunk_split($title,40," ");
$user = chunk_split($user,40," ");
$message = chunk_split($message,40," ");
// convert newline characters ( \n OR \r OR both ) to HTML break tag ( <br> )
$message = nl2br($message);
?>
However this leaves me with odd looking sentences E.G
upd ate more![]()
and tha t could be a shame
need t o appreciate
Therefore I was just wondering if anyone would be able to help me create a piece of code that would prevent the page from breaking, but not cause me to have random spaces in messages?
Thanks all,
Jcb33.