Skip to content

Instantly share code, notes, and snippets.

@henrikbjorn
Created January 15, 2010 12:16
Show Gist options
  • Save henrikbjorn/278010 to your computer and use it in GitHub Desktop.
Save henrikbjorn/278010 to your computer and use it in GitHub Desktop.
<?php
class QuizzesController extends AppController
{
var $helpers = array('Form');
public function index() {
$this->set('description', 'Et xml/flash quiz værktøj');
}
public function save($id = 1) {
//Has any form data been POSTed?
if(!empty($this->data)) {
//If the form data can be validated and saved...
if($this->Quiz->save($this->data)) {
//Set a session flash message and redirect.
$this->Session->setFlash("Quiz Saved!");
$this->redirect('/quizzes');
}
}
//If no form data, find the recipe to be edited
//and hand it to the view.
$this->set('quiz', $this->Quiz->findById($id));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment