Form

hi how to write this in yii

<form method="post">

Name: <input type="text" name="fname"><br>

Age: <input type="text" name="age"><br>

<input type="submit">

</form>

<?php echo $_POST["fname"]; ?><br>

<?php echo $_POST["age"]; ?>

thanks

Hi

check these

http://www.yiiframework.com/doc/guide/1.1/en/form.view

http://www.yiiframework.com/forum/index.php/topic/13943-processing-form-generated-with-chtml

thanks but how can i create a name of the form

In fact, the name of the form is useless.

All the inputs have the nessesary data,

for example the above code


echo $form->textField($model,'nameattribute');

generates something like that


<input name='nameofthemodel[nameattribute]' />



so after of submit you can check if the form is submitted by


if (isset($_POST['nameofthemodel']))...

if you want to set name of the form for other purpose (for example jquery) then you could test this


$form=$this->beginWidget('CActiveForm', array(

    'id'=>'id-of-the-form',

    //....

    'htmlOptions'=>array(

        'name'=>'name-of-the-form',

    ),

));