This file contains 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
<div ng-controller="CustomerController" class="container"> | |
<div class="form-group"> | |
<label for="name">Name</label> | |
<input class="form-control" type="text" ng-model="customer.name" ng-bind="customer.name" required /> | |
</div> | |
<div class="form-group"> | |
<label for="email">Email</label> | |
<input class="form-control" type="text" ng-model="customer.email" ng-bind="customer.email" required /> | |
</div> | |
<div class="form-group"> |
This file contains 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
app.controller('CustomerControler',[ function ($scope) { | |
$scope.customer = { | |
name : 'Anjana Wijesundara', | |
email: 'wsanjana951@gmail.com', | |
username: 'anjanaw' | |
}; | |
}]); |
This file contains 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
public function delete($username = NULL){ | |
$this->customer_model->delete_customer($username); | |
$this->load->view('customer/success'); | |
} |
This file contains 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
public function delete_customer($username = FALSE){ | |
if ($username != FALSE){ | |
return $this->db->delete('customer', array('username' => $username)); | |
} | |
} |
This file contains 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
public function set_customer(){ | |
$data = array( | |
'username' => $this->input->post('username'), | |
'full_name' => $this->input->post('full_name'), | |
'email' => $this->input->post('email') | |
); | |
return $this->db->insert('customer', $data); | |
} |
This file contains 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
public function edit($username = NULL){ | |
$this->load->helper('form'); | |
$this->load->library('form_validation'); | |
$data['customer_item'] = $this->customer_model->get_customer($username); | |
$data['title'] = 'Customer Update'; | |
//$this->load->view('customer/edit', $data); |
This file contains 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
public function create(){ | |
$this->load->helper('form'); | |
$this->load->library('form_validation'); | |
$data['title'] = 'Create a news item'; | |
$this->form_validation->set_rules('username', 'Username', 'required'); | |
$this->form_validation->set_rules('full_name', 'Full Name', 'required'); | |
$this->form_validation->set_rules('email', 'Email', 'required'); |
This file contains 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
<h2><?php echo $title ?></h2> | |
<?php echo validation_errors(); ?> | |
<?php echo form_open('customer/edit') ?> | |
<label>Username</label> | |
<input type="input" name="username" value="<?php echo $customer_item['username']?>"/><br /> | |
<label for="text">Full Name</label> | |
<input type="input" name="full_name" value="<?php echo $customer_item['full_name']?>"/><br /> |
This file contains 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
<h2><?php echo $title ?></h2> | |
<?php echo validation_errors(); ?> | |
<?php echo form_open('customer/create') ?> | |
<label>Username</label> | |
<input type="input" name="username" /><br /> | |
<label for="text">Full Name</label> | |
<input type="input" name="full_name" /><br /> |
This file contains 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
<h2><?php echo $title ?></h2> | |
<label>Username</label> | |
<p><?php echo $customer_item['username']?></p> | |
<label for="text">Full Name</label> | |
<p><?php echo $customer_item['full_name']?></p> | |
<label for="text">Email</label> | |
<p><?php echo $customer_item['email']?></p> |
NewerOlder