Page 1 of 1

nothing in $_POST using DirectoryIndex

Posted: Mon Jan 22, 2007 3:38 pm
by pjungwir
Hello,

I have a form like this:

<form action="/somewhere" method="post"> ... </form>

I process the form in /somewhere/index.php. Apache is configured to use index.php as a DirectoryIndex. But when I get there, $_POST is empty. I only see values in $_POST if my form looks like this:

<form action="/somewhere/index.php" method="post"> ... </form>

I'd prefer to use the simpler URL. Why should it make any difference whether I leave off the "/index.php"?

Thanks,
Paul

Posted: Mon Jan 22, 2007 3:40 pm
by feyd
Maybe it should be /somewhere/

Re: nothing in $_POST using DirectoryIndex

Posted: Mon Jan 22, 2007 3:57 pm
by Mohamed
pjungwir wrote: Apache is configured to use index.php as a DirectoryIndex.
what about the order of DirectoryIndex.
e.g
DirectoryIndex index.html index.php

in that example apache first looks index.html, if it could not find then tries index.php.
so if you have index.html in that folder that means apache loads index.html first.

so may be the problem is the order of DirectoryIndex.

Posted: Mon Jan 22, 2007 4:03 pm
by pjungwir
Hi Feyd,

Thanks for your reply. You are right! Since I was missing the trailing slash, my browser was resubmitting the request and apparently dropping the POSTed parameters. Adding the slash fixed the problem.

Thanks again,
Paul