Special Characters in HTML Forms

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
stovertl1
Forum Newbie
Posts: 3
Joined: Tue Jul 15, 2003 9:00 am
Location: Southampton, PA

Special Characters in HTML Forms

Post by stovertl1 »

I have a simple mail form in which I type the following into the mail message:

The "Iron Men" like Harry's dog.

I retrieve the message body with the following statement:

$Body = $_POST[ "frmBody" ];

When I display $Body, I obtain:

The \"Iron Men\" like Harry''s dog.

How can I eliminate the back slashes before the double quote and apostrophe characters? They appear to be inserted by the PHP form parameter parser. I am using PHP Version 4.3.1.
User avatar
Wayne
Forum Contributor
Posts: 339
Joined: Wed Jun 05, 2002 10:59 am

Post by Wayne »

Code: Select all

stripslashes($Body);
stovertl1
Forum Newbie
Posts: 3
Joined: Tue Jul 15, 2003 9:00 am
Location: Southampton, PA

stripslashes()

Post by stovertl1 »

Thanks Wayne. The stripslashes() function did exactlye what I wanted. This is the first time I've ever used PHP so I have a lot to learn.
m3rajk
DevNet Resident
Posts: 1191
Joined: Mon Jun 02, 2003 3:37 pm

Post by m3rajk »

i suggest getting a php book if you're new. it'll help you learn and you wont need to wait. also try http://www.php.net
they have all the functions etc on there
User avatar
redhair
Forum Contributor
Posts: 300
Joined: Fri May 30, 2003 4:36 pm
Location: 53.23N-6.57E
Contact:

Post by redhair »

m3rajk wrote:i suggest getting a php book....
See this post about wich book to get :wink:
Post Reply