Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP_SELF in a form

Status
Not open for further replies.

petermaci

Programmer
Jun 1, 2004
11
CA
hello I am recursively calling an index.html page through a <form> action call like this...

<FORM action="<?= $_SERVER['PHP_SELF'] ?>" method=post>

this works on my localhost, but not on my remote test server, I get the 405 resource not allowed error... I am thinking that this is just a php.ini or apache setting, any pointers ?

Peter
 
Try replacing $_SERVER['PHP_SELF'] with $HTTP_SERVER_VARS['PHP_SELF']
 
I actually figured this out myself, thanks for the reply.

The problem was that the file was an .HTML file and not a .PHP file, so the interpreter was only configured to deal with .PHP files... I changed the extension and away we went...
 
You dont need the PHP_SELF there.. Just put something like:
Code:
<FORM action="?action=search" method=post>

as long as the action="" is not empty, it will submit to itself! if it is empty, it will submit to the index file!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top