| 
	
 | 
 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] 
 |