tags:

views:

301

answers:

2
+2  Q: 

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?

A: 

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

Scuzzy
no cause i got an answer now from their forum. they used a html helper class that would give assign all the form element attributes inside an array for easier looping through functionality in php:)
weng
+2  A: 

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.

Don