Created
January 9, 2015 04:15
-
-
Save vinacode/9e675138b882777d22ab to your computer and use it in GitHub Desktop.
CakePHP 3 contact controller
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Controller; | |
use App\Controller\AppController; | |
use App\Form\ContactForm; | |
class ContactController extends AppController | |
{ | |
public function index() | |
{ | |
$contact = new ContactForm(); | |
if ($this->request->is('post')) { | |
// $isValid = $form->validate($this->request->data); | |
if ($contact->execute($this->request->data)) { | |
$this->Flash->success('We will get back to you soon.'); | |
} else { | |
$this->Flash->error('There was a problem submitting your form.'); | |
} | |
} | |
$this->set('contact', $contact); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment