Re: HTML Entities and $HTTP_POST_VARS

From: Date: Wed, 31 Oct 2001 18:05:00 +0000
Subject: Re: HTML Entities and $HTTP_POST_VARS
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-13894@lists.php.net to get a copy of this message
Try replacing the values before you dump it into the database: $value = str_replace("#0169", "©", $value); Do that for all the values. You can make it do the reverse when you need to display the values in HTML (although most browsers after Netscape v2.x and IE v3.x recognize these characters without fail). Mike "Zane Good" <zbueno@sprintout.com> wrote in message news:3BE02DC4.2AAC3CA9@sprintout.com... > I'm experiencing a strange problem with HTML entities in > form input using > PHP v. 4.0.4pl1. > > My form consists of three fields: > - A "select" pulldown menu (generated from database) to > enable users to select an existing record; > - A text field in which users enter a headline; > - A textarea field in which users enter text (which can > include HTML entities). > > The input from the form is saved in a MySQL database (v. > 3.23.33). Everything was working fine until I started adding > HTML entities (e.g., &#153;, &#149;, etc.) to represent the > trademark symbol, bullets, etc. in the textarea field. I'm > able to add a record to the database with HTML entities. > However, when I retrieve an existing record, make > modifications in the textarea field, and submit the input, > the "selected" value from the pulldown menu is somehow lost > (not carried forward). > > When I say "lost", I mean that the key for the pulldown > input field is actually missing when I loop through > $HTTP_POST_VARS at the top of the script. If there are no > HTML entities in the textarea field, the value for the > pulldown menu shows up and everything works fine. > > I can't figure out the source of the problem. The encoding > type within the <form> tag is standard: > enctype="multipart/form-data". I'm not altering the input > from the pulldown input field before submittal. > > Even odder, the same form works fine with HTML entities on > older versions of PHP. (This is not to say that there is a > bug in the version I am using, just making the observation). > > Any ideas what's going on? > -- > =-=-=-=-=-=-=-=-=-=-=-=-=-=-= > Zane Good > VP / Director of Operations > Sprintout Internet Services > =-=-=-=-=-=-=-=-=-=-=-=-=-=-= > >

« previous php.db (#13894) next »