It looks much nicer :)
From: Marek Kilimajer <[EMAIL PROTECTED]> To: Mike Mapsnac <[EMAIL PROTECTED]> CC: [EMAIL PROTECTED] Subject: Re: [PHP] Get "nice" variables from POST Date: Thu, 11 Mar 2004 15:59:07 +0100
Mike Mapsnac wrote:
I have about 10 fields in the form. And I get the fields through POST: //Get Variable from the form $username = $_POST['username']; $password = $_POST['password']; $password2 = $_POST['password2']; $email = $_POST['email']; $email2 = $_POST['email2']; $nickname = $_POST['name']; $city = $POST['city']; $state = $_POST['state']; $country = $_POST['country']; $misc = $_POST['misc']; $country = $_POST['country'];
It works but it looks ugly. For each variable I have statemet. Is there a way to get the variables in the loop?
I'm looking for "nice" way to get variables from POST?
Thanks
Does this look nicer?
$fields = array('username', 'password', ...); foreach($fields as $key) $$key = $_POST[$key];
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
_________________________________________________________________
Get a FREE online computer virus scan from McAfee when you click here. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php