I have just started with cake today and I am new to programming and I
am attempting to create a mini survey but I am confused as to how to
direct the user from one page to the next.

I have a few pages created with radio and checkbox questions
firstquestion.ctp
are you alive?
<?php
        $options=array('Y'=>'Yes','N'=>'No');
        $attributes=array('legend'=>false);
        echo $form->radio('storechd',$options,$attributes);
?>

<?php echo $form->button('Next', array('type'=>'submit'));
?>

If I understand correctly the logic for this needs to be in my
controllers files
the pseudo code would be something like:
If isset $options = Yes
Then on submit redirect to secondquestion
else on submit redirect to youclickedno

right now all that I have come up with in my questions_controller is
this, but it does not work as I am missing a lot of information:
function firstquestion() {
                if (isset($options['Y'])) {
                        $this->redirect(array('action' => 'secondquestion'));
                } else {
                     if (isset($options['N'])) {
                           $this->redirect(array('action' =>
'youclickedno'));
                     }
               }
        }

function secondquestion() {
}
function youclickedno() {
}

Basically the problem is I do not know what syntax to use to tell cake
to perform a particular action when the next button is clicked on the
first page.  Does cake have to put this information into the database
first and then retrieve it, or can it simply look at the web page and
see that one of the options is set?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to