Gem Posted March 12, 2009 Share Posted March 12, 2009 Hi guys ... I am very nearly ready to go live with my new very basic cms. I have one last problem I need to overcome though. Basically when the admin users enter information into a form, i.e. News Updates ... they are writing it in plain text ... they have no knowledge of HTML ... So the problem I have is the output comes out without any line break when we press enter on the keyboard ... I'm not sure that makes sense so heres an example ... Heres my form .. <form action="insert.php" method="post"> Title: <BR> <input type="text" name="title" /> <BR>Description: <BR> <input type="text" name="subtitle" /> <BR>News Update: <BR> <textarea name="article" rows="20" cols="75"> </textarea> <BR><input type="submit" /> </form> In the textarea ... I need to be able to write things like First Line Second Line Etc Etc From Gem But at the moment the output im getting on my webpage is First Line Second Line Etc Etc From Gem How do I fix this?? Heres the code that displays the forms information from the database ... <?php $con = mysql_connect("CONNECTION DETAILS"); if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("bssql", $con);$result = mysql_query("SELECT * FROM articles ORDER BY ID DESC");while($row = mysql_fetch_array($result)) { ?><H1><?php echo $row['Title']; ?> </H1> <H2><?php echo $row['SubTitle']; ?> </H2> <?php echo $row['Article']; echo "<br />"; }mysql_close($con); ?> Thanks in advance .. Gem Quote Link to comment https://forums.phpfreaks.com/topic/149096-solved-display-results-from-a-form-problems/ Share on other sites More sharing options...
timmah1 Posted March 12, 2009 Share Posted March 12, 2009 Try this <H1><?php echo nl2br($row['Title']); ?> </H1> <H2><?php echo nl2br($row['SubTitle']); ?> </H2> <?php echo nl2br($row['Article']); Quote Link to comment https://forums.phpfreaks.com/topic/149096-solved-display-results-from-a-form-problems/#findComment-782878 Share on other sites More sharing options...
Gem Posted March 12, 2009 Author Share Posted March 12, 2009 Thanks mate - that cracked it ... dont know how or what that means but it did! Thanks again x Quote Link to comment https://forums.phpfreaks.com/topic/149096-solved-display-results-from-a-form-problems/#findComment-782881 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.