jon4433 Posted June 25, 2012 Share Posted June 25, 2012 Hi, I have a joke website, which allows people to register and post jokes. Now everything is working fine, i'm pretty much ready to release it. But I have problem. I posted a joke earlier to test, and this is what it looked like before I posted it. 'After a 2 year study, the National Science Foundation announced the following results on the American Male's recreational preferences: 1. The sport of choice for unemployed or incarcerated people is: basketball 2. The sport of choice for maintenance level employees is: bowling. 3. The sport of choice for blue-collar workers is: football. 4. The sport of choice for supervisors is: baseball. 5. The sport of choice for middle management is: tennis. 6. The sport of choice for corporate officers is: golf. Conclusion: The higher you rise in the corporate structure, the smaller your balls become.' And this is what it looked like after I posted it. 'After a 2 year study, the National Science Foundation announced the following results on the American Male's recreational preferences: 1. The sport of choice for unemployed or incarcerated people is: basketball 2. The sport of choice for maintenance level employees is: bowling. 3. The sport of choice for blue-collar workers is: football. 4. The sport of choice for supervisors is: baseball. 5. The sport of choice for middle management is: tennis. 6. The sport of choice for corporate officers is: golf. Conclusion: The higher you rise in the corporate structure, the smaller your balls become.' I'm storing the jokes in a database. Is there a way to make it display how it was originally? Here is the code that puts the jokes into the database. Magic quotes are enabled on my webhosting. <?php function filter($value) { // Stripslashes if (get_magic_quotes_gpc()) { $value = stripslashes($value); } // Quote if not a number if (!is_numeric($value)) { $value = mysql_real_escape_string($value); } return trim($value); } if($_POST['submit']){ $username = filter($_SESSION['username']); $joke = filter($_POST['joke']); if(!empty($joke)){ $query = mysql_query("INSERT INTO jokes (username, joke) VALUES ('$username', '$joke')") or die(mysql_error()); echo "<font color=\"green\">Your joke has been posted!</font>"; }else{ echo "<font color=\"red\">You need to enter a joke!</font>"; } } ?> Any help would be much appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/264735-sentences-displaying-like-a-paragraph/ Share on other sites More sharing options...
The Little Guy Posted June 25, 2012 Share Posted June 25, 2012 are you using nl2br? Quote Link to comment https://forums.phpfreaks.com/topic/264735-sentences-displaying-like-a-paragraph/#findComment-1356828 Share on other sites More sharing options...
jon4433 Posted June 25, 2012 Author Share Posted June 25, 2012 No i'm not. Looking at that the page where it explains it all... Would it be easy to implement? Quote Link to comment https://forums.phpfreaks.com/topic/264735-sentences-displaying-like-a-paragraph/#findComment-1356876 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.