|
|
|
Form data can be passed by $HTTP_POST_VARS to a function or another form and then quickly
reinitialze data
<input type=text name=email>
<input type=text name=firstname>
.
.
.
When submitted you can usually reference the variable by name ie:
<?
if($email)
?>
but if you have a long list of variables you want recreated or passed to a function you can do the
following:
<?
foreach($HTTP_POST_VARS as $keys=>$values){
${$keys}=$values;
}
?>
it's like saying
<?
$email=$HTTP_POST_VARS['email'];
?>
for all values within the HTTP_POST_VAR array
<?
function foo($HTTP_POST_VARS){
foreach($HTTP_POST_VARS as $keys=>$values){
${$keys}=$values;
}
if($email=someone@somewhere.com){
//do something
}
}
?>
now instead of doing this
<?
$email=$HTTP_POST_VARS['email'];
$firstname=$HTTP_POST_VARS['firstname'];
?>
all the values are initialized and can be used with out renaming or reseting them |
|
| Check parameters validity. Paranoia was designed to check the validity of the parameters that a php page will receive after a form submission. It can be used to check the variables sent by POST or GET Categories : Algorithms, HTML and PHP, PHP, Variables | | | PHP3: Formmail. Just a cgi formmail, but than in PHP. It is easy to use! Categories : HTML and PHP, Email, PHP, Perl, HTML and PHP | | | Make old style (PHP3) scripts using GET, POST, COOKIE and File uploads (POST) compatible with
PHP 4.2.0 Categories : PHP, HTML and PHP, Global Variables, Cookies, Variables | | | Simple script to passing persistent and growing array between recalls of one page (manipulate little stack). Categories : Arrays, Global Variables, PHP, HTML and PHP, Variables | | | a function that builds an HTML select list from any mysql table. Categories : PHP, MySQL, HTML and PHP | | | Message of the Day - Random Message (Needs MySQL!) Categories : Databases, HTML and PHP, PHP, MySQL | | | Alternating background color for HTML table rows Categories : PHP, Databases, MySQL, HTML and PHP | | | Constantly refresh your PHP/HTML page data. Categories : PHP, HTML and PHP, Sybase | | | clearing variables in php3 Categories : Variables, Arrays, PHP | | | Select with current month Categories : PHP, HTML and PHP, Date Time, Arrays | | | background music script for random notes in a frame Categories : PHP, Content Management, HTML and PHP | | | A very simple way to build and do a hierarchical html categories browser without javascript , just using html php and mySql
Categories : HTML and PHP, Databases, Algorithms, PHP, MySQL | | | PageRank Display Categories : Search Engines, HTML and PHP, PHP | | | PhpView 0.1 - simple php viewer, using temporary files and frames.
Categories : PHP, PHP Options and Info, Debugging, HTML and PHP | | | Automatically printing the contents of an sql table in MySQL. Categories : MySQL, PHP, HTML and PHP, Databases | |
| | | | Ray Cauchi wrote :919
You can also do it this way
extract($_POST);
one line, nice and easy.
And, using the Super Gloabl arrays ($_GET, $_POST etc etc) you have access to the variables anywhere - they are global in scope.
RTM to confirm the details on both...
| |
|
|
|