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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.