I have a view \game\game.php with a controller GameController.php and model GameForm.php.
In my view I have one form that, when submitted, is giving another form in the same page. But when submitting the last one, I am redirected to the appliction home-page (server/app/index.php) instead of the game- page (server/app/game).
I also tried to use a different action for the second form (action=‘check.php’) and therefore created a method actionCheck in my GameController and a view views/game/check.php, but this seems not to be enough: “unable to find the requested action “check.php”.”
What is this? It looks like a cut & paste job. I have never seen $_SERVER[‘PHP_SELF’] in ANY example for Yii.
You really need 50 Submit buttons?
Your code indicates that you have TWO forms both posting to the same action with no indication which form triggered the posting.
What you are missing is that the form action is being set to check.php through $_SERVER[‘PHP_SELF’], not not “index.php?r=game/check”. (check the PHP docs for what this returns)
Look at the contact form in the Yii Skeleton app. Use the activeForm. set the action to array(‘game/check’). I also noticed a number of $variables where are they coming from.
I did something with PHP before I met Yii. Copy & paste, probably from W3schools.
As the first submit must be handled by the current view-script.
I could use a form with just two input text-fields flagID and flagValue, but instead of user entering flagId himself, I want him to click the corresponding Flag-button, which will generate a the form with input field for FlagValue (must retain flagID, so post it again in hidden input; NB: both fields come from a static table Flags, no CRUD actions and so on).
Maybe I should use Component instead of submit-buttons.
Thank you for opening my eyes. Works with action=‘check’.
Do you mean the iterator (submit-buttons) and flagID (variable input-value/ activeLabel)?