Hi All
In my app I had form and visitors can select any city to go to another page related to selected value .
So I created my code , but the problem data not sent .
Data is city id , I tested it in tamper data and no data sent , how to fix that and send data in get method
Model:
public function events_by_city(){
return CHtml::listData(Events::model()->findAll("start >=now() and active=1"),'city','city0.ecity');
}
Controller :
//////// start upcoming related to city
public function actionUpcomingcity(){
if(isset($_GET['city'])){
$city=intval($_GET['city']);
$courses=Courses::model()->findAll(" course_id in (select course_id from ict_events where start >=now() and city=$city and active=1 ) ",array('distinct'=>true,
)) ;
$this->pageTitle=" Events";
$this->layout='rsidebar';
$this->render('upcoming_by_city',array(
'courses'=>$courses
));
}
else{
echo " No number ";
}
}
View :
<?php
CHtml::form();
$model= new Events;
echo chtml::activeDropDownList($model,'city',$model->events_by_city(),array('prompt'=>'استعراض الأحداث التدريبية ',"submit"=>array("site/upcomingcity",'city'=>$model->city)
)
);
CHtml::endForm();
?>
Thanks in advance