Jump to content

Displaying Text Correctly.


elmas156

Recommended Posts

I've got a simple internal messaging system that I'm trying to get the text to display the way it was entered when a message was sent.  The messages are inserted into the database using variables generated through this function:

 

<?php
function safe($value){
return mysql_real_escape_string($value);
} 

	$staffid=form($_POST['staffid']);
	$from=safe($_POST["from"]);
	$category=form($_POST['category']);
	$subject=safe($_POST["subject"]);
	$message=safe($_POST["message"]);
	$grade=form($_POST['grade']);
?>

 

when the text is inserted, there are back slashes automatically inserted behind certain punctuation marks.

 

For example, is someone sends a message that says, "Someone's using phpfreaks forums."  It would be inserted as, "Someone\'s using phpfreaks forums."

 

How can I stop this from happening?  Or how can I remove the "\" when displaying the string on the web page?  Any help is greatly 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.