Hello.
I currently have a problem with $_SERVER["PHP_SELF"] when called from within an included file:
I have a several files included in one script, here are some snips of those files:
head.php
include( "./functions.php" );
include( "./constants.php" );
switch( $action ){
case "add":
$file = "addclient.php";
break;
case "view":
$file = "viewclient.php";
break;
default:
$file = "cust_main.php";
}
cust_main.php
<form action="<? $SERVER["PHP_SELF"] ?>">
<input type="hidden" name="action" value="add">
....
</form>
<form action="<? $SERVER["PHP_SELF"] ?>">
<input type="hidden" name="action" value="view">
....
</form>
index.php
include( "./head.php" );
<table>
<tr><td><? include( "./top.php" ); ?></td></tr>
<tr><td><? include( $file ); ?></td></tr> <!-- this file will dynamically change -->
<tr><td><? include( "./bot.php" ); ?></td></tr>
</table>
The first time the script runs the default file loads fine but, when the submit button is pressed to send all the information to the server it seems that the head.php file doesn't get parsed or called only the file where the PHP_SELF was called. the variable $action never get changed. How can I work around this?
Thanks in advanced for your help.