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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Diff browsers formatting data differently when using POST and GET

Status
Not open for further replies.

iggystar

IS-IT--Management
Jul 12, 2001
126
US
I have a simple little script that captures some data from a form and the just e-mails it off. My problem is, IE isn't formatting the data the way I expect it too.

For example, I ask for first and last names, among other things. When I use the Opera browser it sends the data to me like this:
firstname=bob&lastname=smith

Where are the data items are seperated by a "&" symbol. This is how I expected it to work.

When IE sends the info it sends it to me like this:
firstname=Bob lastname=Smith
where the data isn't seperated by "&" and then my script goes on to choke when it tries to process the data since I'm expecting the "&" symbols.

It seems to be that the way Opera is formatting the data is way it should be and I don't understand why IE is doing it differently.

Is there anything I can do, somewhat command I can send to the IE Browser for example, that will cause it to format it's data the way Opera does?

Thanks.
 
I've tried it using IE 6.0 and 5.5

I'll chop down the HTML to just a simply form and then check it again and post it.
 
Ok here's a simple form with only 3 bits of data:

<HTML>
<form name=&quot;form1&quot; METHOD=&quot;POST&quot; ENCTYPE=&quot;text/plain&quot; action=&quot;http:test2.pl&quot;>

<TABLE cellpadding=&quot;3&quot; CELLSPACING=0 BORDER=&quot;0&quot; WIDTH=480>

<TR>
<TD VALIGN=&quot;MIDDLE&quot; COLSPAN=4>
<INPUT TYPE=&quot;TEXT&quot; MAXLENGTH=&quot;15&quot; NAME=&quot;firstname&quot;>
</TD>
</TR>


<TR>
<TD VALIGN=&quot;MIDDLE&quot; COLSPAN=4>
<INPUT TYPE=&quot;TEXT&quot; MAXLENGTH=&quot;20&quot; NAME=&quot;lastname&quot;>
</TD>
</TR>

<TR>
<TD VALIGN=&quot;MIDDLE&quot; COLSPAN=4>
<INPUT TYPE=&quot;TEXT&quot; MAXLENGTH=&quot;15&quot; NAME=&quot;title&quot;>
</TD>
</TR>

<TR>
<TD WIDTH=&quot;100%&quot; VALIGN=&quot;MIDDLE&quot; align=center>
<INPUT TYPE=&quot;submit&quot; VALUE=&quot;Submit&quot; id=submit1>
</TD>
</TABLE>

</FORM>
</html>


And here's the most simple perl script to process this data ever:

read ( STDIN, $data, $ENV{'CONTENT_LENGTH'} );
print &quot;Content-Type: text/html\n\n&quot;; # print out our header
print ( $data );


Now when I submit this form using IT I get this as the output of the script:

firstname=a lastname=b title=c

But when I submit the very same page using Opera I get this:

firstname=a&lastname=b&title=c


The output that Opera gives is what I expected and I don't understand why IE is giving different output. Thanks in advance for any help.
 
It's the [tt]ENCTYPE=&quot;text/plain&quot;[/tt] which is confusing IE.

//Daniel
 
Yep, that would do it. The enctype should be &quot;application/x- (the default) or &quot;multipart/form-data&quot; (if you're using inputs of type file).

Opera must be ignoring the value and using the default. I find it interesting that IE would actually try to do it.

Want the best answers? Ask the best questions: TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top