this may be helpful I wrote it for my own problems with forms -> database
this will only be the code to echo out the 'notes' field the inserting into db I assume is already covered
keep in mind this deals with tabs as well.
<?php
//values from form
$notes=$_POST['notes'];
// call format_notes function to remove newline,tabs
format_notes($notes);
// define the format_notes function and receive variable
function format_notes($notes) {
$tab="\t";
$nbsp=" "; // each = 1 space
$no_tabs=str_replace($tab,$nbsp,$notes);
$clean=nl2br($no_tabs);
echo $clean;
}
?>
output
If I hadn't put the function together it would look like this:
I'm told this isn't the best way to go but for my own purposes right now it seems to be just fine