|
|
|
|
|
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 | | | 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 | | | 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 | | | 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 | | | Multiple Select box, Select multiple Items from Menu.List box Categories : PHP, HTML and PHP, Beginner Guides | | | mySQL/PHP/search with multientry
form and table output with colored rows Categories : PHP, Beginner Guides, MySQL, HTML and PHP, Databases | | | Directory TreeView - File Manager & Explorer - FTP - Utility - PHP/HTML - Categories : PHP, Directories, FTP, Filesystem, HTML and PHP | | | Calendar using Date function Categories : HTML and PHP, PHP, Date Time, Calendar | | | Variable serialization and unserialization. Loading and saving variable structures
to and from file. Categories : Arrays, Filesystem, Variables, Strings, PHP | | | Website colour changer Categories : PHP, HTML and PHP, Date Time | | | Automatic global variable definer Categories : PHP, Variables, Beginner Guides | | | XTemplate, a template class for PHP Categories : PHP Classes, HTML and PHP, PHP | | | Upload Script, Upload File Script, Input Type="File" Categories : PHP, HTML and PHP, HTTP | | | This script shows you the 7th latest php items from the mailing list archive on zend.com Categories : HTML, HTML and PHP, HTTP, PHP | | | AITSH Statistics Categories : Complete Programs, Databases, HTML and PHP, Sessions, PHP | |
| |
| | | | | 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...
| |
|
|