Confusion with html entities
I am POSTING a form to the same page, validating and sanitizing the input then re displaying the page, with preserved user input, if there are any user errors such as missing form items or incorrect formats.
When an error is detected and the page re displays I use :
value="<?php if (isset($_POST['textfield'])) {echo htmlentities($_POST['textfield']);
and
value="<?php if (isset($_POST['textarea'])) {echo htmlentities($_POST['textarea']);
to re display the user input.
My problem occurs when I use single or double quotes in the form, the display shows the equivalent " or ' instead of preserving the quotes from user input.
Perhaps this is correct, it makes sense, but I thought I was doing the right thing by using html entities to redisplay user input? I presume I am not using it correctly or missing something?
I would appreciate any help and advise with this problem
Thank you in advance.
