note 54105 deleted from reserved.variables by nlopess

From: Date: Thu, 23 Jun 2005 20:07:37 +0000
Subject: note 54105 deleted from reserved.variables by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-90861@lists.php.net to get a copy of this message
Note Submitter: spiderman at matrixhome dot com ---- It took me a long time to find this and I thought I would share... look at how much coding you save... Use this... $p =& $_POST; extract($p); Instead of this ... $username = $HTTP_POST_VARS['username']; $passwd = $HTTP_POST_VARS['passwd']; if(isset($HTTP_POST_VARS['action'])) $action = $HTTP_POST_VARS['action']; else $action = $HTTP_GET_VARS['action']; if(isset($HTTP_POST_VARS['account'])) $account = $HTTP_POST_VARS['account']; else $account = $HTTP_GET_VARS['account']; $messageid = $HTTP_GET_VARS['messageid']; $to = $HTTP_POST_VARS['to']; $cc = $HTTP_POST_VARS['cc']; $subject = $HTTP_POST_VARS['subject']; $message = $HTTP_POST_VARS['message']; This returns the post $p =& $_POST; <<< this builds an array of your Vars an places them in $p (array) If you print_r($p); you will understand extract($p); <<< This extracts the data into the vars automatically... So from above the $action $username $to $cc are all filled in... Now you say but wait I have something called $cc then lookup the extract function and you will love this time saver!

« previous php.notes (#90861) next »