Hello. How do I pass a parameter to an action? I have something like this:
public function actionLevel($level)
{
$this->level = $level;
... do stuff ...
}
What can I put in the URL to pass a value to the “level” action? I was thinking of something like …/index.php?r=game/level&level=4 but that doesn’t work. I tried reading the level through $_GET[‘level’] but that wasn’t it either.
What is the standard way to give a value to an action? There has to be a solution, even if it's not exactly the way I imagine it. This need is too elementary for there not to be a way to do it. Imagine that you have a game and on the front page the user chooses what level they want to play at. User clicks on "Level 5". What do you do then? How do you tell Yii that this user wants to play at level 5?