I am new to PHP
, Yii
-framework and web programming in general.
So I have some difficulties in writing simple registration form.
I have tables Persons
, Categories
, Properties
, CategoryProperties
, PropertyValues
:
Persons ( name, category_id)
Categories(category_id, category_name)
Properties(propety_id, property_name)
CategoryProperties(category_id, property_id)
PropertyValues(property_id, category_id, person_id, some_value)
For example, category_name = 'teacher'
, property='work experience
', some_value='15'
.
Depending on which category
was selected we should display block with properties matching that category.
How to get selected value from dropdown list (Categories) and use it to display another form which depends on that value and other database table?
So far I have only this
<div class="form">
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'login-form',
'enableClientValidation'=>true,
'clientOptions'=>array(
'validateOnSubmit'=>true,
),
)); ?>
<p class="note">Fields with <span class="required">*</span> are required.</p>
<div class="row">
<?php echo $form->labelEx($model,'name'); ?>
<?php echo $form->textField($model,'name'); ?>
<?php echo $form->error($model,'name'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'category'); ?>
<?php
echo $form->dropDownList($model,'category',
Categories::model()->getAssocList(), array('empty'=>'Select category')?>
<?php echo $form->error($model,'category'); ?>
</div>
<div class="row buttons">
<?php echo CHtml::submitButton('AddReader'); ?>
</div>
<?php $this->endWidget(); ?>
</div><!-- form -->