correct entry for php_self



I have tried text book the example below, however,
$PHP_SELF contains the full pathname of the file, rather than the location of the file relative to localhost.
The page is called using http://localhost/picturecash/selfcall.php
$PHP_SELF=/var/www/html/picturecash/selfcall.php, hence I get the error 404 when the for posts.
How do I get the page to successfully call its self?
Thanks.
<?php
$num_to_guess=42;
$message="";
if (!isset($guess))
{
$message= "Welcome <BR>Value of guess not set." ;
}
elseif ($guess > $num_to_guess )
{
$message="Number too BIG";
}
elseif ($guess < $num_to_guess )
{
$message="Number too SMALL";
}
else
{
$message="Guess CORRECT";
}
?>
<HTML>
<HEAD>
<TITLE>Number Guessing Script</TITLE>
</HEAD>
<BODY>
<H1>
Message is<?php print $message ?>
<?php
print "<BR>Value of /$PHP_SELF = ".$PHP_SELF;
if(isset($guess))
{
print"<BR>guess value is ". $guess;
}
else
{
print "<BR>Value of guess NOT set.";
}
// <?php print phpinfo() ?>
?>
</H1>
<FORM ACTION="<?php print $PHP_SELF?>" METHOD="POST">
Type our guess here:<INPUT TYPE="TEXT" NAME="guess">
</FORM>
</body>
</html>
.



Relevant Pages

  • Re: Php error in module mode and not in CGI
    ... Here is phpinfo with php module: ... Directive Local Value Master Value ... SMTP localhost localhost ... Interfaces Countable, OuterIterator, RecursiveIterator, SeekableIterator, ...
    (comp.lang.php)
  • Re: Why is localhost added to all my links ?
    ... Hal Halloway wrote: ... if you prefix a URL with http:// or just a /, ... > is and localhost is not added. ... PHP does have a mechanism via which you can control what markup elements ...
    (comp.lang.php)
  • Re: Check out this email....[Fwd: The next big thing for websites]
    ... still brings up my own localhost account. ... its not online and its only my localhost account. ... For example if you are using php: ... importantly to see how successful their spam is and collect IP ...
    (Ubuntu)
  • Re: Sending email from PHP script.
    ... I am testing my scripts on localhost with PHP ... reconfigure PHP or Appache. ... PHP must be able to access a mail server. ...
    (comp.lang.php)
  • Re: Sending email from PHP script.
    ... reconfigure PHP or Appache. ... I had this issue awhile back and found a good 'free' mail server that allowed me to use mailon the localhost to test email coding. ...
    (comp.lang.php)