>if (is_array($_POST)) {
> foreach($_POST as $name=>$value) {
> ${$name} = $value;
> }
>}
or use this
if (is_array($_POST))
{
extract($_POST);
}
Jaski
__
Do you Yahoo!?
Yahoo! Search - Find what youre looking for faster
http://search.yahoo.com
--
PHP Gen
if (is_array($_POST)) {
foreach($_POST as $name=>$value) {
${$name} = $value;
}
}
/tom
On Fri, 12 Mar 2004 15:59:00 +0100 (CET)
Hans Juergen von Lengerke <[EMAIL PROTECTED]> wrote:
> I know this isn't what you want, but nevertheless, this
> "does not look ugly":
>
>
>
> # Get varia
I know this isn't what you want, but nevertheless, this
"does not look ugly":
# Get variables from the form
#
$username = $_POST['username'];
$password = $_POST['password'];
$password2 = $_POST['password2'];
$email = $_POST['email'];
$email2= $_POST['email2'];
$nickname
On 12 Mar 2004 Richard Davey wrote:
> Indeed.. roll-on input filters in PHP5 :)
Hmmm, can't find the docs on those online.
--
Tom
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
On 12 Mar 2004 Mike Mapsnac wrote:
> I try to use quotes in the query and this doesn't work.
>$query = "SELECT * FROM user WHERE user_id = '$_POST['user_id']}'";
> But you use brackets and it works.. Why do you use brackets ?
> $query = "SELECT * FROM user WHERE user_id = ${_POST['user_id']}";
On 11 Mar 2004 Chris Shiflett wrote:
> The risk is no greater than what the original poster wants to do anyway:
>
> $foo = $_POST['foo'];
>
> Whether $foo is created by register_globals being enabled or by the
> previous code, there is no difference in risk. The data should still be
> considered
--- [EMAIL PROTECTED] wrote:
> Yes but register_globals carries substantial security risks since a
> hacker can then set any script variable they wish merely by POSTing it
> back in response to your form.
The risk is no greater than what the original poster wants to do anyway:
$foo = $_POST['fo
On 11 Mar 2004 Rob Adams wrote:
> Along the same lines, I've found this helpful when inserting into mysql.
>
> foreach($_POST as $key => $val)
> $$key = mysql_escape_string($val);
I just wrote a cleanup routine which applies a number of
transformations -- it's called at the start of every pag
"Mike Mapsnac" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
>
> >From: Marek Kilimajer <[EMAIL PROTECTED]>
> >
> >$fields = array('username', 'password', ...);
> >foreach($fields as $key) $$key = $_POST[$key];
> >
> Thanks.
>
> It looks much nicer :)
Along the same lines, I've fou
> Does this look nicer?
>
> $fields = array('username', 'password', ...);
> foreach($fields as $key) $$key = $_POST[$key];
Hi Marek,
A bit confused...whats the meaning of the double $ for "key"...or is that a
typo?
Thanks,
-Ryan
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe,
On Thu, Mar 11, 2004 at 02:51:25PM +, 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'];
>
Thanks.
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 t
On 11 Mar 2004 Teren wrote:
> If you have register_globals on in your php.ini file, you don't need to do
> that. You just automatically have access to all of those variables like
> $username and $password etc. Whatever the name is on the field is what the
> string will be called and the action scr
On 11 Mar 2004 Mike Mapsnac wrote:
> I'm looking for "nice" way to get variables from POST?
Well you can do it easily with extract:
extract($_POST);
This has the same security risks as turning register_globals on, it
allows hackers to set any variable they wish.
A better method might
If you have register_globals on in your php.ini file, you don't need to do
that. You just automatically have access to all of those variables like
$username and $password etc. Whatever the name is on the field is what the
string will be called and the action script can access those immediately by
$
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']
16 matches
Mail list logo