Problems with \ and " with PHP

A

Anonymous

Guest
Hi, i have a basic submit page which submits news stories into a database.

There is a <textarea> box which you add the story in.

And then on the second page, submit.php there is an insert statement, which is working perfectley. To display the details that has been entered, there is

News Story: <?php echo "$news" ?>

which displays the news submitted. But the problem is.

If i write,
Joe Bloggs yesterday spoke for the first time "I am better".

and submit that as the story, it submits it into the database and the submit.php page as

Joe Bloggs yesterday spoke for the first time \"I am better\".

It Adds the \ \ to the "" and makes it \" \".

Any way around it, so it doesnt add the \" instead of " .


Cheers VERY much
 
AaaDee said:
Hi, i have a basic submit page which submits news stories into a database.

There is a <textarea> box which you add the story in.

And then on the second page, submit.php there is an insert statement, which is working perfectley. To display the details that has been entered, there is

News Story: <?php echo "$news" ?>

which displays the news submitted. But the problem is.

If i write,
Joe Bloggs yesterday spoke for the first time "I am better".

and submit that as the story, it submits it into the database and the submit.php page as

Joe Bloggs yesterday spoke for the first time "I am better".

It Adds the \ \ to the "" and makes it " ".

Any way around it, so it doesnt add the " instead of " .


Cheers VERY much

Hi!
Try using function stripslashes
Or reading http://www.php.net/manual/en/function.stripslashes.php
 
Back
Top