Form submission with file upload problems.

I have a basic page with a form.  1 text box.

<html>
<head>
<title></title>
</head>
<body>
<form name="all_events" action="test2.php" method="post">
     <input type="text" name="Event_Name">
     <input type="file" name="UPDF">
     <input type="submit" value="submit">
</form>
</body>
</html>

When I submit to test2.php I get whatever was typed in the box.

TEST2.php
<html>
<head>
<title></title>
</head>
<body>
<?php
    print($Event_Name);
?>
</body>
</html>

Now, I need text1.php to upload a file.  If I add enctype="multipart/form-data" to the form in text1.php, I get an error:

Warning: Undefined variable: Event_Name in /var/www/html/siteinasnap/test2.php on line 7

I have tested this and narrowed it down.

On servers with 4.0.6 it seems to work, at least on the ones I tried.  On 4.1 and above, it doesn't seem to work.  What changed or what can I look at so it works?  Is there a setting to ensure that variables are read out of the querystring on a post?  Do you need to read these variable s differently?  I tried $_POST but it still doesn't think it's been defined.

When I change the type to get, everything works.  I don't want to use get though.

Any ideas?
Stephen
mindarchAsked:
Who is Participating?
 
Richard QuadlingConnect With a Mentor Senior Software DeveloperCommented:
You MUST use $_POST for V4.2+ (maybe V4.1 was optional).

0
 
Richard QuadlingSenior Software DeveloperCommented:
Try ...

$HTTP_POST_VARS["Event_Name"]


also check the global_vars settings in php.ini

<?php phpinfo(); ?>

Regards,

Richard.
0
 
azzkikrCommented:
Works for me on both 4.2.1/Win and 4.1.2/Linux.
I'm getting it thru $_POST["Event_Name"].

Regards,
Stas
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
mindarchAuthor Commented:
azzkikr - I haven't been using $_POST["Event_Name"] before and would prefer not to use it, because that would mean changing a lot of already written code.  I checked the php settings and don't see a difference between the ones that work and the ones that don't, at least in any areas that would matter for this.

Mindarch
0
 
mindarchAuthor Commented:
azzkikr - I haven't been using $_POST["Event_Name"] before and would prefer not to use it, because that would mean changing a lot of already written code.  I checked the php settings and don't see a difference between the ones that work and the ones that don't, at least in any areas that would matter for this.

Mindarch
0
 
us111Connect With a Mentor Commented:
chekc in your php.ini if you have
register_globals     =     On
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.