WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : A quick way set data from a form to a function or other places where you can lose scope.
Categories : PHP, HTML and PHP, Variables Update Picture
s l
Date : Apr 04th 2003
Grade : 4 of 5 (graded 6 times)
Viewed : 7867
File : No file for this code example.
Images : No Images for this code example.
Search : More code by s l
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

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...