PDA

View Full Version : Php Code


rjkd
05-19-2003, 01:16 PM
Hi need some help.Can anyone explain to me what $PHP_SELF and $HTTP_POST_VARS is used for?

Thanks

whackaxe
05-19-2003, 02:42 PM
$PHP_SELF, should be used as $_SERVER['PHP_SELF'] (i think) it is used to refer to the current script's name. $HTTP_POST_VARS[] is now depreciated it should now be $_POST[]. it is an array of the info you have sent to the script using the post method in a form like so

<FORM NAME="myform" ACTION="myscript.php" METHOD="post">
<input type="text" name="field1"><input type="submit">
</FORM>

then on myscript.php


<?php
$myvar = $_POST['field1'];
print($myvar);
?>


that will display the text you entered on the first page. the other method is "GET" which is less secure because it submits the data with the URL of the script