Re: Re: Need help storing and displaying html/text!
| From: | Jason Wong | Date: | Tue, 11 Feb 2003 06:04:50 +0000 |
| Subject: | Re: Re: Need help storing and displaying html/text! | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-135162@lists.php.net to get a copy of this message | ||
On Tuesday 11 February 2003 07:03, Shawn McKenzie wrote:
> Hmmm... I guess no one is doing this??? Seems fairly common.
Patience. You should allow 1 day to give every list subscriber a chance to
read your post.
> "Shawn McKenzie" <nospam@mckenzies.net> wrote in message
> news:20030210220142.1944.qmail@pb1.pair.com...
>
> > I have a form and I want the user to be able to enter html in a text
> > area. This will then be stored in an array in a config file. Example
> > $htmlstuff[1] = '<script type="text/javascript>some stuff
> > here</script>';
> >
> > When they visit the form again it will display as they entered it and
> > they can modify it and save it back to the array. The problem is I keep
>
> getting
>
> > multiple \ on the single and double quotes every time they submit the
>
> form,
>
> > as well as multiple newlines and trailing spaces.
> >
> > I have looked at and tried combinations of stripslashes(),
> > htmlspecialchars() and htmlentities(), so I don't need a link to the PHP
> > manual. I can't find the right combination and don't know when to do
> > what to get this to work. Can anyone give me a good example?
The new recommended settings for magic_quotes_* are OFF so in psuedo-code:
INPUT
get data from post/get and validate
html_entity_decode() the data
addslashes() to data and insert into DB
OUTPUT
get data from DB
htmlentities() the data
output it
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
The answer to the question of Life, the Universe, and Everything is...
Four day work week,
Two ply toilet paper!
*/