<? Php echo $ PHP_SELF?> No work in PHP 5.x?

I know that with PHP 4.1 they introduced the concept of super-globals that I don’t quite understand, but I had the following code working with PHP 4.3.x (or something close to it) and recently updated to PHP 5.2.4 , and now the information does not seem to want to be sent to my database. It just brings me back to the same page I was trying to send from.

if ($submit) {
mysql_select_db("ibmclub",$db);
$sql = "INSERT INTO april_floral (image) VALUES ('$image')";
$result = mysql_query($sql);
header("location:confirm.php");
} else {
<form method="post" action="<?php echo $PHP_SELF?>">
<form guts>
<?php
}
?>

You get the gist. You are having trouble escaping in brackets to get the code.

So does s exist

+3
source share
2 answers

Moved to $_SERVER['PHP_SELF']. register_globals is deprecated and will be completely removed in a future version of PHP. Better update your code so you don't rely on it.

+5
source

it is possible that your option has register_globalsbeen disabled with the update you made. The correct way to use it is<?php $_SERVER['PHP_SELF'] ?>

0
source

All Articles