RE: [PHP] problem in writing into an html text file
| From: | Matt Honeycutt | Date: | Thu, 27 Feb 2003 23:23:22 +0000 |
| Subject: | RE: [PHP] problem in writing into an html text file | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-137484@lists.php.net to get a copy of this message | ||
Check stripslashes(), I think that will help you.
---Matt
-----Original Message-----
From: Michael P. Carel [mailto:mikecarel@teamglac.com]
Sent: Thursday, February 27, 2003 4:53 PM
To: php-general@lists.php.net
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" <jsheets@php.net>
> To: "Michael P. Carel" <mikecarel@teamglac.com>
> Cc: <php-general@lists.php.net>
> 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