RE: [PHP] POSTing HTML into a database
-Original Message- From: James Arthur [mailto:[EMAIL PROTECTED]] Sent: 07 January 2002 21:41 snip For example, consider the string $body = I am saying \Hello\; input type=hidden name=body value=?=$body is interpreted by the browser as input type=hidden name=body value=I am saying Hello And so we have a problem. What can I do about that? Since this is generating HTML, you need to encode these characters as HTML entities -- consider using the htmlspecialchars() function (see http://www.php.net/manual/en/function.htmlspecialchars.php) or htmlentities() (see http://www.php.net/manual/en/function.htmlentities.php). Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] POSTing HTML into a database
On Monday 07 January 2002 01:59, Richard S. Crawford wrote: I've used a combination of addslashes() and stripslashes() along with htmlspecialchars() to perform just that sort of thing, though I used MySQL instead of PostreSQL. Can you help me along a bit further? I can't seem to get them in the right order. Thanks. --jaa -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] POSTing HTML into a database
Hi I need a user to be able to enter submit HTML code (also perhaps containing PHP code) via a web form, which will then be entered into a database. The data is typed in to a textarea, which is then posted to my script. I notice that some special characters come out of this process escaped, but the escaping sequence does not appear to be entirely compatible with the SQL query I'm using to insert it into a table. Can anyone tell me the correct way to convert the output from the form into a format that PostgreSQL will accept, and then how to convert it back so that it's identical to what the user entered before being escaped by post (so that I can just use print to print it out)? Thanks. --jaa -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] POSTing HTML into a database
I've used a combination of addslashes() and stripslashes() along with htmlspecialchars() to perform just that sort of thing, though I used MySQL instead of PostreSQL. Does anyone know, by the way, if there's a port of PostreSQL to Windows 2000? Or can I run it in Cygwin? At 03:45 PM 1/6/2002, James Arthur wrote: Hi I need a user to be able to enter submit HTML code (also perhaps containing PHP code) via a web form, which will then be entered into a database. The data is typed in to a textarea, which is then posted to my script. I notice that some special characters come out of this process escaped, but the escaping sequence does not appear to be entirely compatible with the SQL query I'm using to insert it into a table. Can anyone tell me the correct way to convert the output from the form into a format that PostgreSQL will accept, and then how to convert it back so that it's identical to what the user entered before being escaped by post (so that I can just use print to print it out)? Thanks. --jaa -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] Sliante, Richard S. Crawford http://www.mossroot.com AIM: Buffalo2K ICQ: 11646404 Y!: rscrawford MSN: [EMAIL PROTECTED] It is only with the heart that we see rightly; what is essential is invisible to the eye. --Antoine de Saint Exupéry Push the button, Max! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] POSTing HTML into a database
Does anyone know, by the way, if there's a port of PostreSQL to Windows 2000? Or can I run it in Cygwin? I've seen it in the package list for Cygwin, there may be a full port as well, check Postgres' web site. -Adam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]