コード例 #1
0
 public function index()
 {
     $contact = new ContactForm();
     if ($this->request->is('post')) {
         if ($contact->execute($this->request->data)) {
             $this->Flash->success('Order submitted successfully and its value is ' . $contact->getPrice());
         } else {
             $contact->setErrors(["email" => ["_required" => "Your email is required"]]);
             $this->Flash->error('There was a problem submitting your form.');
         }
     }
     $this->set('contact', $contact);
 }