Multipart/form-data enctype drops variable with ampersand on POST
Posted on 2005-04-29
We have a "member profile" page that users can login to and edit any values that we have stored in the database. We load the values into an array from the database and display them on the form for editing.
Sample of current HTML used:
<form action="submission_form_db.php" method="POST" enctype="multipart/form-data">
<intput type="name" value="......value from database....">
..... (other input fields)....
..... (image upload field as well).....
When I submit this form and do a print_r($POST) it completely removes the 'name' variable from the POST array and doesn't display it. After trial and error I found that the problem only occurs if the the name value from the database has an ampersand (&) in it. If the name value from the database does NOT have an ampersand, the POST submission works perfectly and the 'name' POST var stays in tact. Also, if the original value does NOT have an ampersand, but then during editing I add an ampersand and submit, it STILL updates perfectly. So the problem is only occuring when the original value has an ampersand (and the problem still occurs if I delete the ampersand from the field and then submit).
To me, it makes no sense. And to make matters more confusing, if we remove the enctype from the FORM tag it works perfectly! So it's something with the ampersand and the enctype.
PHP Version 4.3.4
Edit: When we pull the data out of the database and populate the form that is posting to the problem page, we replace ampersands with &, so that's not the problem.