Bug #13953 Updated: HTML Entities and $HTTP_POST_VARS

From: Date: Tue, 06 Nov 2001 21:10:45 +0000
Subject: Bug #13953 Updated: HTML Entities and $HTTP_POST_VARS
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-69722@lists.php.net to get a copy of this message
ID: 13953
Updated by: jeroen
Reported By: markm@sprintout.com
Status: Open
Bug Type: Arrays related
Operating System: Free BSD 4.2
PHP Version: 4.0.4pl1
New Comment:

Please submit the shortest reproducing script which does something strange. It's very hard to
track down the problem if you don't show us exactly what you did.

Previous Comments:
------------------------------------------------------------------------

[2001-11-06 13:30:29] markm@sprintout.com

Removing enctype="multipart/form-data" from the form tag does seem to solve the problem.
However, it creates another. I was planning to add a "file" input type field to the form
to enable users to upload images. To accomplish that, I'll need to include
enctype="multipart/form-data". What then? Also, I was hoping to get to the bottom of the
problem and figure out what's going on with HTML entities and form input. Thanks.

------------------------------------------------------------------------

[2001-11-06 10:29:25] sander@php.net

Why are you using multipart/formdata? That shouldn't be necessary. Try using a simple
<form> tag like <form action="script.php" method="post">. 

Does it work this way?

------------------------------------------------------------------------

[2001-11-06 09:17:23] markm@sprintout.com

I'm experiencing a strange problem with HTML entities in form input using PHP v. 4.0.4pl1 on
Apache v. 1.3.17.

My form consists of three fields:
  A "select" pulldown menu to enable users to select an existing record (field name:
"InfoID");
  A text field in which users enter a headline (field name: "InfoTitle");
  A textarea field in which users enter text (field name: "InfoText").
  
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.

When I say "lost", I mean that the key for the pulldown input field is actually missing
when I print out $HTTP_POST_VARS (through the print_r function) 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.

Any ideas what's going on?

------------------------------------------------------------------------



Edit this bug report at http://bugs.php.net/?id=13953&edit=1



Thread (8 messages)

« previous php.dev (#69722) next »