$_POST annoyingly empty

Hello

I have a problem that is almost cracking my nutcase.

I have a form that is sent to a PHP script with method post. The main (and probably only) problem is, that the $_POST-array is empty in the receiving end.

I have another form (without file upload) that works like a charm.

I am quite sure there is something wrong in the form, but to my annoyance I can’t find out what. Another possibility would be PHP-settings, but I haven’t found anything suspicious.

I have been programming in PHP since SuSE 6.1 regularly (almost daily) and never ever had this kind of problem which furthemore kicks my a** :confused:

If you want to check the problem, it can be found at
Vesivehmaa Open

It is in Gibberish-language but never mind :wink:

The receiving end is just a print_r for $_POST.

If anyone can shed me some light I would be very grateful :slight_smile:

Best regards

hannu

Usually means you’ve forgotten to add enctype=‘multipart/form-data’ to the post element.

Yes, I agree…

But I haven’t forgotten (I tested it a little while ago without it, so you may have seen it without, but it was there and it is again)

I have been digging all the time and get more and more frustrated :confused:

The $SERVER variable has [REQUEST_METHOD] => GET which seems to be carved in stone… I’d think it should be POST, when method=post", right?

hannu

This works for me:

<form action='somescript.php' method='post' enctype='multipart/form-data'>

Also if you are uploading a big file, make sure the upload limit is high enough in php.ini.

<form action=‘http://vvopen2011.padasjoenlentokerho.fi/igc_test_file.php’ method=‘post’ enctype=‘multipart/form-data’ >

The file uploaded is some hundred kilobytes, so the size shouldn’t be a problem.

I have been doing this a lot and mostly things have gone smoothly, but now this is just stuck :confused:

I took the form from the main site and it can be found here:
http://apps.padasjoenlentokerho.fi/websites/vvopen2011/loggeritiedot.php

After you click the L*****-button you get $_POST and $_SERVER-globals

This is driving me crazy…

hannu

Worked fine for me. I changed action to point to this script

<?php
print_r($_POST);
?>

and got this result:

Array ( [MAX_FILE_SIZE] => 900000  => http://appserver.padasjoenlentokerho.fi/websites/vvopen2011/index.php?id=121 [err_url] => http://appserver.padasjoenlentokerho.fi/websites/vvopen2011/index.php?id=122 [comp] => 1 [kilp_nimi] => [kilp_tunnus] => [butt] => Lähetä )

So maybe the receiving site doesn’t permit POST? Check the Apache config there.

So…it seems that the problem lies somewhere else than in the PHP or HTML (form) code … I guess.

My first “handler” was exactly that print_r($_POST] as well. Only it didn’t work … :confused:

hannu

Humhum

I started just from the scratch and now it works… I really can’t see any difference in the previous code in the form and the current, but the basic difference is that the newer works :slight_smile:

This may be one of the black holes in the wonderland of programming, but who cares after it works :slight_smile:

Thank you for your help, Ken :slight_smile:

hannu

Maybe you wrote that post script with a Windows editor and the first line was actually <?php^M where ^M is the carriage return? Or something like that?

Someone I knew used to have PHP scripts fail to run on a Linux server until I pointed out that he had to set the destination server type in Dreamweaver so that the deployer would do the right thing with line endings.