You are here: correct entry for php_self « All PHP « IT news, forums, messages
correct entry for php_self

Posted by carlton on 07/17/06 17:30

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>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация