Jump to content

Sentences displaying like a paragraph


jon4433

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/264735-sentences-displaying-like-a-paragraph/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.