Re: Request help - Output is not formatted right
| From: | jeremy brand | Date: | Fri, 03 Nov 2000 19:44:47 +0000 |
| Subject: | Re: Request help - Output is not formatted right | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-23630@lists.php.net to get a copy of this message | ||
When dealing with form input, you should run your data through
htmlspecialchars() -- or htmlentities() if you are paraniod.
What this will do is print out:
<
instead of printing
<
etc... htmlspecialchars() takes care of the 4 dangerous chars as far
as <form>s go. Htmlentities() goes so far as to encode every char.
The awful side effect is that your page will probably be four times
(at least) the size effecting the user's download time.
-jeremy brand
_______________________________________________________________________
GnuPG Fingerprint: 9F5E 95E0 1CC2 E054 84EA 6099 8ACD 9DBA D2C0 5EA9
_ http://www.JeremyBrand.com/Jeremy/Brand/Jeremy_Brand.html
for more __
On Fri, 3 Nov 2000, Scott Walter wrote:
> Date: Fri, 03 Nov 2000 14:40:57 -0500
> From: Scott Walter <sdw1@geneseo.edu>
> To: php-general@lists.php.net
> Subject: [PHP] Request help - Output is not formatted right
>
> I created a very simply web page that fills in a regular <form> with the
> values that already exist in the database that it queries. It fills the
> form in correctly, but then I have it generate a confirmation page with the
> all of the form values in a more printable form. On the confirmation page,
> any value that has a special character in it, such as a single quote, it
> prints a backslash (the escape character). How do I get it to not print
> the escape character.
>
> i.e.
> <td>Location of Funds:</td>
> <td><?php print "$funds_loc"?></td>
>
> produces the output:
> Location of Funds: Scott\'s National Bank
>
> the catch is, that in the database, the \ isn't there. If anyone can help
> me I would really appreciate it.
>
>
> -Scott Walter
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>