You need to wrap your dropdown in a form. This worked. Also note $groupe
gets assigned if there is a $_GET
variable. Your combo is posting, so you need to use $_POST['groupe']
<form method="post" action="<?= $this->createUrl('') ?>">
<?php
echo CHtml::dropDownList('groupe', $groupe, array(
"A" => "A",
"B" => "B",
"C" => "C",
"D" => "D",
"E" => "E",
"F" => "F",
"G" => "G",
"H" => "H"
), array(
'prompt' => '--Choisir un groupe--',
'submit' => CController::createUrl('classement'),
//'data'=>array('groupe'=>'js:this.value'),
));
?>
</form>
I removed the models for testing the controller.
public function actionClassement($groupe = "") {
echo $groupe;
if (isset($_POST['groupe'])) {
echo $_POST['groupe'] . "ici=" . $groupe;
$groupe = $_POST['groupe'];
}echo 'test';
// $model = Team::model()->getClassementByGroupe($groupe);
// $games = array();
// $games = Game::model()->getGameByGroupe($groupe);
//echo '<pre>test';echo print_r($model);echo '</pre>';
$this->render('view', array(
'groupe' => $_POST['groupe'],
));
}