Jump to content


Photo

Form no accepting html


  • Please log in to reply
2 replies to this topic

#1 mcmuney

mcmuney
  • Members
  • PipPipPip
  • Advanced Member
  • 358 posts

Posted 19 September 2006 - 05:20 AM

I'm using a script to send messages to members within my site, but the form doesn't accept html. Plus, everywhere there's ' is used, on reply it adds a bunch of \\\\\'. I've narrowed this problem down to the following lines (particularly the htmlspecialchars and addslashes). Any help to explain this would be greatly appreciated:

$subject = htmlspecialchars($subject);
$body  = htmlspecialchars($body);
$sql="INSERT INTO `sc_messages` (`smg_from`, `smg_to`, `smg_subject`, `smg_body`, `smg_postdate`,`smg_block` ) VALUES ('$social_mem_id','$scm_mem_id ','$subject','".addslashes($body)."','$time','$smg_block')";



#2 shortj75

shortj75
  • Members
  • PipPipPip
  • Advanced Member
  • 118 posts
  • LocationPort Huron,mi

Posted 19 September 2006 - 07:49 AM

did you try to use stripslashes like so

$body = $_POST['body'];


$body = stripslashes($body);

that should remove the //////
but i did notice that you are useing addslashes($body) that will add the ///////  so change addslashes to stripslashes and that should solve your problem
The Short One

hopfully this helps if it doesn't sorry
i won't write the code for you!!! you don't learn that way

#3 mcmuney

mcmuney
  • Members
  • PipPipPip
  • Advanced Member
  • 358 posts

Posted 20 September 2006 - 11:15 PM

Strange, if I replace "addslashes" with "stripslashes", it no longer writes to the database.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users