forked from petanikode/tutorial-codeigniter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPage.php
More file actions
58 lines (46 loc) · 1.13 KB
/
Copy pathPage.php
File metadata and controls
58 lines (46 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Page extends CI_Controller
{
public function index()
{
$data['meta'] = [
'title' => 'BeritaCoding',
];
$this->load->view('home', $data);
}
public function about()
{
$data['meta'] = [
'title' => 'About BeritaCoding',
];
$this->load->view('about', $data);
}
public function contact()
{
$data['meta'] = [
'title' => 'Contact Us',
];
$this->load->library('form_validation');
if($this->input->method() === 'post'){
$this->load->model('feedback_model');
$rules = $this->feedback_model->rules();
$this->form_validation->set_rules($rules);
if ($this->form_validation->run() == FALSE)
{
return $this->load->view('contact', $data);
}
$feedback = [
'id' => uniqid('', true),
'name' => $this->input->post('name'),
'email' => $this->input->post('email'),
'message' => $this->input->post('message')
];
$feedback_saved = $this->feedback_model->insert($feedback);
if($feedback_saved){
return $this->load->view('contact_thanks');
}
}
$this->load->view('contact', $data);
}
}