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

multipart/form-data woes

Status
Not open for further replies.

gbrian

IS-IT--Management
Sep 22, 2004
96
0
0
US
I am continuing to have the same problem when using this enctype on a form. All of the data is being passed, however, if I compare the value of a hidden input to it's string equivalent--it does not equate.

IE-- a hidden input with a value of "test" passed back to the script via multipart/form-data: if I echo the value, I will SEE test, however, if I try someVar == "test" it returns false. This causes problems when trying to write variables to mySQL, using if statements after submission (to check for required fields, valid input, ETC ETC)

If I remove the enctype--everything is FINE. The reason I am using multipart is due to a file upload ability on the script.

PHP Version 4.0.4pl1
Apache Version Apache/1.3.14


Any ideas?
 
Have you tried assigning the post variable to a variable then checking it against the string?

$yv = trim($_POST['yourvar']);
if ($yv == 'test')
{
echo 'true';
} else {
echo "Variable yv is $yv";
}

What do you get?
 
Actually, $yourvar = trim($yourvar); did the trick. Does the multipart encoding type add some garbage characters?

Thanks for the help, this is what I needed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top