Php faq. In versions later than PHP4.2, the default value of register_global is off. if you want to get the variable submitted from another page: Method 1: in PHP. find register_global in ini and set it to on. method 2:
In versions later than PHP4.2, the default value of register_global is off.
To get the variables submitted from another page:
Method 1: Find register_global in PHP. ini and set it to on.
Method 2: Put the extract ($ _ POST); extract ($ _ GET) at the beginning of the receiving page. (note that extract ($ _ SESSION) you must have Session_Start ()).
Method 3: Read the variable $ a =$ _ GET ["a"]; $ B =$ _ POST ["B"] one by one. Although this method is troublesome, it is safer.
PHP code:
Ob_Start ();
Session_Start ();
Echo"
";
Echo "the _ GET variables obtained on this page include :";
Print_R ($ _ GET );
Echo "the _ POST variables obtained on this page include :";
Print_R ($ _ POST );
Echo "the _ COOKIE variables on this page are :";
Print_R ($ _ COOKIE );
Echo "the _ SESSION variables obtained on this page include :";
Print_R ($ _ SESSION );
Echo"
";
?>
Why do I get only the first half when I send a variable to another web page, and all the variables starting with a space are lost?
PHP code:
$ Var = "hello php"; // change it to $ Var = "hello php"; what are the results?
$ Post = "receive. php? Name = ". $ Var;
Header ("location: $ post ");
?>
Content of receive. php:
PHP code:
Echo "";
Echo $_GET["Name"];
Echo "
";
?>
The correct method is:
PHP code:
$Var="hello php";
$post= "receive.php?Name=".urlencode($Var);
header("location:$post");
?>
You do not need to use Urldecode () on the receiving page. the variable is automatically encoded.
Standardize your SQL statements
In the table, add "'" before the field so that it will not be misused.
If you want to obtain the variable submitted from another page: Method 1: Find register_global in PHP. ini and set it to on. Method 2: connect...