I have a kind of a guestbook on my page. It's just a common textarea like this:
echo '
<textarea name="msg"></textarea>';
and then I use a form to send me to the backend on submit:
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$jinput = JFactory::getApplication()->input;
$msg = $jinput->getString('msg');
$columns = array('message');
$values = array($db->quote($msg);
$query->insert($db->quoteName('guestbook'))->columns($db->quoteName($columns))->values(implode(',', $values));
$db->setQuery($query);
$db->execute();
But my problem is, that if the user write something like:
Hey.
This is a nice site.
Bye for now!
The guestbook prints out:
Hey. This is a nice site. Bye for now!
How can I get the line breaks from the user-inputs?
EDIT: I echo the results like this:
$results = $db->loadObjectList();
foreach ($results as $row) {
echo $msg;
}