ajsie
ajsie

Reputation: 79846

yii form question

in the yii documentation it says:

foreach($_POST['LoginForm'] as $name=>$value)
{
    if($name is a safe attribute)
        $model->$name=$value;
}

what does the array LoginForm come from? which attribute is it coupled to?

Upvotes: 3

Views: 903

Answers (2)

Don
Don

Reputation: 4673

In PHP, $_POST contains the input fields 'posted' from an HTML form.

In an HTML form, items have names

Address: <input type='text' name='LoginForm[addr]'>
City: <input type='text' name='LoginForm[city]'>
ST: <input type='text' name='LoginForm[st]'>

So when PHP provides this input to the script it makes the input into an array by the names, which you can iterator over with the foreach.

Upvotes: 3

Scuzzy
Scuzzy

Reputation: 12332

The $_POST Array? if so that is a reserved/predefined variable, and it contents is usually that of the result of submitted forms. Is this what you are asking?

http://www.php.net/manual/en/reserved.variables.php

Upvotes: 0

Related Questions