Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8340157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:06:14+00:00 2026-06-09T05:06:14+00:00

Here is an example of the workflow a user can have on my website

  • 0

Here is an example of the workflow a user can have on my website :

  1. Create a task, with content: I use htmlentities to encode the content and store it in my database (yes, I’ve decided to store the encoded content);

  2. The user comes back later and clicks to view the task. The thing is, the preview of the content is done in a disabled textarea.

    • I tried to use htmlentities_decode when printing the content in the textarea (XSS problem if the user entered bad things);

    • I just print the encoded text and everything is fine.

  3. The user clicks on EDIT, this will make the textarea editable

  4. The user clicks on SAVE.

Here is my main issue, as I didn’t decode the text before I printed it, it is still encoded and when the user saves it, it is re-encoded. So, the previous content is double encoded.

So, if the first time the user enters something like:

blablabla  </textarea/> yeah!

Then, it’s encoded and the result is:

blablabla  &lt;/textarea/&gt; yeah!

Then, when I display it, it displays as the user previously entered it but if he saves it, the result is:

blablabla &amp;lt;/textarea/&amp;gt; yeah!

And, so, if he displays it again, it is not well displayed (and it also takes more and more space in my database as the user keeps editing his task).

Well, I am sure this is a problem a lot of people have experienced but I can’t find any good solution.

By the way, I am using htmlentities with ENT_QUOTES.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T05:06:15+00:00Added an answer on June 9, 2026 at 5:06 am

    Hum,
    I fixed my problem.
    I didn’t noticed but for the first entry, I was using htmlentities() and when editing, I was using the Zend escape() function.
    Using only htmlentities() fixed the problem. I don’t know how the escape() function of ZF works, but I won’t use it in the future :p

    Thanks you for answers 🙂

    Anyway, so, I am wondering, the htmlentities_decode() function, in which situation should it be used? As I htmlentities() when I get the form and print it like that, I never use the htmlentities_decode(). Is that normal? So I am wondering what is this function used for?

    Thanks again!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my example : We have printers. We can define page formats that
Here is example which I have try <?php include 'spider/classes/simple_html_dom.php'; $html = new simple_html_dom();
I found an example here to create a select list with optgroups using KnockoutJS.
Checking the datagrid example here http://www.silverlight.net/content/samples/sl4/toolkitcontrolsamples/run/default.html see the datagrid section It says that if
I have an example here: int runcmd(char *cmd) { char* argv[MAX_ARGS]; pid_t child_pid; int
I have been looking at the WF Wizard examples on endpoint.tv and here: http://stevenalexander.posterous.com/integrating-a-persisted-wf40-workflow-with-mv
Here's my application workflow. I have a ref cursor that is populated with all
I'm integrating my website with a third party system. Here's the workflow between my
I have the below Json (wf.json) { workflow:{ template:Analysis1, start:{ instance:HDA_run1, user:symtest, date:3-Mar-2012, timestamp:1330948220475
Here is the work-flow of my situation: I have a website that allows registered

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.