Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Weird $_POST array

Status
Not open for further replies.

DeepBlerg

Technical User
Jan 13, 2001
224
AU
Hi,

I have the following form elements below on my page:

<SELECT MENU>
<TEXT FIELD>
<TEXT AREA>
<TEXT FIELD>
<TEXT FIELD>

I have noticed that when someone copies and pastes text from MS Word that includes apostrophes and double quotes into the text area and the form is submitted to PHP, the value selected in the select menu is dropped from the $_POST array. It makes no sense at all especially when the form is filled out without copying and pasting from Word, all the elements are accessable in PHP.

Why is this?
 
It's probably something to do with the way Word encodes some of the characters. I assume this problem exists using IE

A couple of experiments to try just to better define the limits of the problem:

Try it with a non-IE browser, like Opera or Mozilla.

Try is again with IE, but with your form using the 'enctype="multipart/form-data"' attribute.

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
I would also suggest downloading Mozilla, and get the WebDeveloper extension. It has a button you can click which will change all of your POST information to GET information so you can look at it another way.

Failing that, switch your form type from POST to GET and look at the URL.

If all that fails, pass your form submission through some client side javascript to make sure the sending browser agrees with you.

 
Hi skiflyer,

I tried switching my form to GET method instead of POST and I can now retrieve the Select value, but the minute I change it back to POST it disappears if the Textarea is populated from Word and contains double quotes etc.

Does this narrow down what the problem is?
 
No, I'd say it confuses matters all the more :).

How are you verifying the lack of existence in the post array? I'm assuming...
Code:
echo '<pre>';
print_r($_POST);
echo '</pre>';

Just so you see everything getting sent in the POST array... but I'm afraid other than those debugging tips this one has me stumped without seeing more code.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top