TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 01-22-2008, 12:35 PM   #1 (permalink)
The Contributor
 
Join Date: Jan 2008
Posts: 87
Thanks: 49
StevenF is on a distinguished road
Default Enctype="text/plain" - Can someone explain why?

Hello,

I have created a database and wrote some php to connect to it. I then added another page which contained a form and an input field. When you entered data in the field, it would search a field in the database for a match and then display the results. For some reason the form wasn't passing the information over the PHP page. In the end I figured out it was because of this:

Code:
Enctype="text/plain"
I don't know what was causing this to happen. Can someone please explain?

Thanks,
Steven
StevenF is offline  
Reply With Quote
Old 01-22-2008, 12:51 PM   #2 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

You must have added that unless you downloaded the form. Basically you have all sorts of enctypes, the most popular for form submission being multipart/form-data. What the form would be trying to do there is to simply push plain text items through, I don't know for certain but I imagine the POST or GET would be there, but simply not parsed correctly by PHP. Perhaps as one big long string.
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
The Following User Says Thank You to Wildhoney For This Useful Post:
StevenF (01-22-2008)
Old 01-22-2008, 12:59 PM   #3 (permalink)
The Contributor
 
Join Date: Jan 2008
Posts: 87
Thanks: 49
StevenF is on a distinguished road
Default

Thanks Whildhoney. I'm still a little confused to why that was stopping the data from being passed over to the other page. Would it be possible that it was changing the numbers enter to text?
StevenF is offline  
Reply With Quote
Old 01-22-2008, 05:00 PM   #4 (permalink)
The Frequenter
Newcomer 
 
xenon's Avatar
 
Join Date: Dec 2007
Location: Bucharest, Romania
Posts: 438
Thanks: 3
xenon is on a distinguished road
Default

Actually, the POST forms have by default application/x-www-form-urlencoded as the enctype (multipart/form-data must be used in order to be able to upload files). The text/plain enctype specifies that the document in question (the form in your case) is a text container. Therefore, the form doesn't really exist anymore, as form data must be serialized before submitted to be processed server-side. Since you were using plain text as the form's contents, there was no data to submit.
__________________
I have optimistic thoughts, even though sometimes (if not always) life's a bitch.
xenon is offline  
Reply With Quote
The Following 2 Users Say Thank You to xenon For This Useful Post:
EyeDentify (01-23-2008), StevenF (01-22-2008)
Old 01-22-2008, 05:24 PM   #5 (permalink)
The Contributor
 
Join Date: Jan 2008
Posts: 87
Thanks: 49
StevenF is on a distinguished road
Default

Quote:
Originally Posted by xenon View Post
Actually, the POST forms have by default application/x-www-form-urlencoded as the enctype (multipart/form-data must be used in order to be able to upload files). The text/plain enctype specifies that the document in question (the form in your case) is a text container. Therefore, the form doesn't really exist anymore, as form data must be serialized before submitted to be processed server-side. Since you were using plain text as the form's contents, there was no data to submit.
Oh ok, thanks for that!
StevenF is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 05:52 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design