Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <---contact.ctp--->/Vendor/croogo/croogo/Nodesview/contact.ctp
- <?php
- echo $this->Session->flash();
- echo $this->Form->create('Post');
- echo $this->Form->input('name',array('required'=>'required'));
- echo $this->Form->input('email',array('required'=>'required','type'=>'email'));
- echo $this->Form->input('phone',array('required'=>'required'));
- echo $this->Form->input('subject',array('required'=>'required'));
- echo $this->Form->input('message',array('required'=>'required', 'type' => 'textarea')).'<br>' ;
- echo $this->Form->end('SEND');
- ?>
- <---NodesController.php--->
- public function contact() {
- if (!empty($this->request->data)) {
- if ($this->Post->save($this->request->data)) {
- App::uses('CakeEmail', 'Network/Email');
- $Email = new CakeEmail();
- $Email->from(array($this->request->data['Post']['email'] => $this->request->data['Post']['name']));
- $Email->to('[email protected]');
- $Email->subject($this->request->data['Post']['subject']);
- $Email->send($this->request->data['Post']['message']);
- $this->Session->setFlash('Email sent.');
- $this->redirect(array('action' => 'contact'));
- }
- }
- $this->set('posts', $this->Post->find('all'));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement