Now a week into php and Yii, I am running into some obstacles. I am trying to link to a new page depending on the selected dropdown item, passing the value to _POST, but for some reason, _POST is never set. I have my code listed below. Thanks for looking. Any help will be greatly appreciated.
controller code:
public function actionList()
{
if(isset($_POST['id']))
{
$this->render($industry->name, array('/industry/show','id'=>$industry->id));
}
else
{
$criteria=new CDbCriteria;
$pages=new CPagination(Contact::model()->approved()->count($criteria));
$pages->pageSize=self::PAGE_SIZE;
$pages->applyLimit($criteria);
$sort=new CSort('Contact');
$sort->attributes = array(
'user'=>array(
'asc'=>'lname, fname',
'desc'=>'lname DESC, fname DESC',
'lable'=>'Contact'
),
'graduation'=>'graduation',
);
$sort->applyOrder($criteria);
$models=Contact::model()->approved()->with('companies')->findAll($criteria);
$industries = array();
foreach(Industry::model()->findAll() as $industry)
{
$industries[$industry->id] = $industry->name;
}
$this->render('list',array('models'=>$models,'sort'=>$sort,'industries'=>$industries,'pages'=>$pages));
}
}
view code: (this isn’t all of the view code, but the relevant parts. if you think I need to supply something else, let me know!)
<div id="filter">
Filter by Industry:
<?php echo CHtml::dropDownList('id','name', $industries); ?>
<?php echo CHtml::submitButton('Filter'); ?>
<br />
</div>
<? if(!empty($testMessage))
{
?><div id="test"> <?php echo $testMessage; ?></div><?
$testMessage = "";
} ?>
Thanks again!