Check stripslashes(), I think that will help you.

---Matt

-----Original Message-----
From: Michael P. Carel [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 27, 2003 4:53 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] problem in writing into an html text file


this code add a backslashes in all doubleqoutes in the html file.

sample:
before editing my.html file

<textarea name="message" cols="95" rows="20">

after editing my.html file

<textarea name=\"message\" cols=\"95\" rows=\"20\">

any idea why and how can i avoid this?


> sorry here's the sample code:
>
> <?
> if(!$submit){
> ?>
> <form>
> <?
>  $filename="my.html";
>  $fd=fopen($filename,"r+")  or die("Can't open file $filename");
>   $message = fread($fd, filesize($filename));
>   fclose($fd);
> ?> <textarea name="message" cols="95" rows="20"><? echo
> $message;?>/textarea>
> <input type="submit"  name="submit" value="modify">
> </form>
> <?
> }else{
>
>       $filename="my.html";
>       $fd=fopen($filename,"w")  or die("Can't open file $filename");
>       $fstring=$message;
>       $fout = fwrite($fd, $fstring);
>       fclose($fd);
>
> }
> ?>
>
> the html file upon modify multiplies all the backslashes.
>
> any idea why? thanks in advance.
>
>
>
> ----- Original Message -----
> From: "Jason Sheets" <[EMAIL PROTECTED]>
> To: "Michael P. Carel" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Thursday, February 27, 2003 12:04 PM
> Subject: Re: [PHP] problem in writing into an html text file
>
>
> > Hello Mike,
> >
> > You will need to better describe your problem and preferably show some
> > source code.
> >
> > What characters are being added to it?  You could use str_replace or the
> > regular expression replacement functions but you should not get added
> > characters in general.
> >
> > Jason
> > On Wed, 2003-02-26 at 19:07, Michael P. Carel wrote:
> > > hi to all,
> > >
> > > Im having a problem writing an HTML code in a text file which comes
from
> the
> > > html text area as an editor. There's an added characters inserted to
it.
> How
> > > could i write to it perfectly?
> > >
> > > mike
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to