nothing in $_POST using DirectoryIndex

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
pjungwir
Forum Newbie
Posts: 2
Joined: Mon Jan 22, 2007 3:31 pm

nothing in $_POST using DirectoryIndex

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Maybe it should be /somewhere/
Mohamed
Forum Newbie
Posts: 21
Joined: Fri Jan 19, 2007 6:59 pm
Location: Seattle

Re: nothing in $_POST using DirectoryIndex

Post 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.
pjungwir
Forum Newbie
Posts: 2
Joined: Mon Jan 22, 2007 3:31 pm

Post 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
Post Reply