fputs() unwanted backslashed

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

louisb
New php-forum User
New php-forum User
Posts: 3
Joined: Mon Nov 11, 2002 2:48 am
Location: UK
Contact:

fputs() unwanted backslashed

Postby louisb » Mon Nov 11, 2002 3:37 am

I am having a small problem while updating a text file, using fputs();
Any quotes or double quotes within the $main variable (which is written to the file) have a preceding backslash added to them.

The $main variable has been passed from a form textarea.

Does any have any idea why this is or what I have done wrong.

if (isset($main)){
if($mainfile=fopen("../../content/main.txt","w")){
fputs($mainfile,$main);
fclose($mainfile);
}else{
echo("Could not open file for writing!");
}
}

Thanks,

LouisB

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

Re: fputs() unwanted backslashed

Postby WiZARD » Mon Nov 11, 2002 5:36 am

louisb wrote:I am having a small problem while updating a text file, using fputs();
Any quotes or double quotes within the $main variable (which is written to the file) have a preceding backslash added to them.

The $main variable has been passed from a form textarea.

Does any have any idea why this is or what I have done wrong.

if (isset($main)){
if($mainfile=fopen("../../content/main.txt","w")){
fputs($mainfile,$main);
fclose($mainfile);
}else{
echo("Could not open file for writing!");
}
}

Thanks,

LouisB

What is OS you use?
It's very important!

louisb
New php-forum User
New php-forum User
Posts: 3
Joined: Mon Nov 11, 2002 2:48 am
Location: UK
Contact:

Postby louisb » Mon Nov 11, 2002 6:39 am

I'm running on UNIX?


Return to “PHP coding => General”

Who is online

Users browsing this forum: Google [Bot] and 1 guest