Solved

Form submission with file upload problems.

Posted on 2002-07-30
8
199 Views
Last Modified: 2006-11-17
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
0
Comment
Question by:mindarch
8 Comments
 
LVL 40

Expert Comment

by:RQuadling
ID: 7188017
Try ...

$HTTP_POST_VARS["Event_Name"]


also check the global_vars settings in php.ini

<?php phpinfo(); ?>

Regards,

Richard.
0
 
LVL 1

Expert Comment

by:azzkikr
ID: 7188129
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
 

Author Comment

by:mindarch
ID: 7188166
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:mindarch
ID: 7188167
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
 
LVL 40

Accepted Solution

by:
RQuadling earned 50 total points
ID: 7188175
You MUST use $_POST for V4.2+ (maybe V4.1 was optional).

0
 
LVL 8

Assisted Solution

by:us111
us111 earned 50 total points
ID: 7188282
chekc in your php.ini if you have
register_globals     =     On
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
php email 2 26
wamp versus xampp 4 43
How can I upload multiple images from a HTML form? 2 18
Before I get too far.. best way to save dates data 4 14
This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now