A question about the use of $PHP_SELF
I'm studyng PHP programming.
I tried the following example i got from a tutorial:
<FORM ACTION="<?php echo($PHP_SELF); ?>" METHOD=POST>
<P>Type your joke hereBR>
<TEXTAREA NAME="joketext" ROWS=10 COLS=40 WRAP></TEXTAREA><BR>
<INPUT TYPE=SUBMIT NAME="submitjoke" VALUE="SUBMIT">
When I type a text into the form and submit it, I receive the message that it is unable to find the page
with the URL:
I'm using PHP version 4.3.0
Could you help me to find what is wrong please ?
You'll need to use $_SERVER['PHP_SELF'] instead (or turn on the "register globals" directive in php.ini).
Older versions of PHP (< 4.2.0) had register globals on by default, but since 4.2.0 have register globals is off.
The example you quoted was no doubt based on one of the older PHP versions.
For more information, try:
Self is the default action for a form so just leave it out.
Instead of using <?php echo($PHP_SELF); ?>, you can just use <?=$PHP_SELF?> as a shortcut.
that variable won't work with 4.3.0. Like has been mentioned - $_SERVER['PHP_SELF']
Originally Posted by Gybbyl
But on top of that, despite the fact that he's not likely to be using XML namespaces anytime soon, using the short PHP tags like you suggest is not recommended do to conflict with XML.
Plus they may be disabled in the php.ini
-- You lived inside my world so softly
-- Protected only by the kindness of your nature