Problems with \ and " with PHP

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

User avatar
AaaDee
New php-forum User
New php-forum User
Posts: 25
Joined: Mon Jun 24, 2002 1:10 am
Location: Huddersfield
Contact:

Problems with \ and " with PHP

Postby AaaDee » Wed Jul 10, 2002 1:07 am

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

User avatar
Oleg Butuzov
Last Samuray
Last Samuray
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

Postby Oleg Butuzov » Wed Jul 10, 2002 1:28 am

read herehow to add slashs and herehow to delete slashes...

User avatar
WiZARD
Moderator
Moderator
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol
Contact:

Re: Problems with \ and " with PHP

Postby WiZARD » Wed Jul 10, 2002 4:01 am

AaaDee wrote: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

User avatar
AaaDee
New php-forum User
New php-forum User
Posts: 25
Joined: Mon Jun 24, 2002 1:10 am
Location: Huddersfield
Contact:

Completed

Postby AaaDee » Wed Jul 10, 2002 4:56 am

Hiya folks, completed now.

cheers


Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 2 guests