first of all, using wamp server , learning basic php grammar.
so first form php file is
<form action="foo.php" method="post"> name: <input type="text" name="username" /><br /> email: <input type="text" name="email" /><br /> <input type="submit" name="submit" value="submit me!" /> </form>
and foo.php file is
<?php // available since php 4.1.0 echo $_post['username']; echo $_request['username']; import_request_variables('p', 'p_'); echo $p_username; // of php 5.0.0, these long predefined variables can // disabled register_long_arrays directive. echo $http_post_vars['username']; // available if php directive register_globals = on. of // php 4.2.0 default value of register_globals = off. // using/relying on method not preferred. echo $username; ?>
but when open localhost/form2.php works fine , input "username" , "email". after gives following error:
notice: undefined variable: http_post_vars in c:\wamp\www\foo.php on line 13 notice: undefined variable: username in c:\wamp\www\foo.php on line 19
apparently, these codes supposed work,, it's not working me reason. there wrong wamp server? or possibly wrong how set configuration?? thank !
as can read on php.net, $http_post_vars
deprecated. not available anymore since php5.4, no wonder says undefined variable
.
$username
, works register_globals=on
- wamp has on off
, should be.
summa summarum: use $_post
Comments
Post a Comment