Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //Controller untuk menambahkan:
- //-start-//
- function __construct(){
- parent::__construct();
- $this->load->model('title_model');
- $this->load->library('form_validation');
- }
- public function tambah()
- {
- $this->form_validation->set_rules('nama', 'Nama', 'required');
- $this->form_validation->set_rules('alamat', 'Alamat', 'required');
- $data['nama'] = array(
- 'name' => 'nama',
- 'id' => 'nama',
- 'placeholder' => 'Nama Lengkap',
- 'type' => 'text',
- 'class' => "form-control"
- );
- $data['alamat'] = array(
- 'name' => 'alamat',
- 'id' => 'alamat',
- 'placeholder' => 'Alamat',
- 'type' => 'text',
- 'class' => "form-control"
- );
- $data['kirim'] = array(
- 'type' => 'submit',
- 'value' => 'Simpan',
- 'class' => "btn btn-theme"
- );
- if ($this->form_validation->run() !== FALSE)
- {
- $this->load->view('formsuccess');
- }
- else
- {
- $this->load->view('template', $data);
- }
- }
- function tambah_aksi(){
- $nama = $this->input->post('nama');
- $jenis_kelamin = $this->input->post('alamat');
- $data = array(
- 'nama_pd' => $nama,
- 'alamat' => $alamat,
- );
- $this->pesertadidik_model->addpd($data,'sk_pesertad');
- redirect('admin/pesertadidik');
- }
- //-end-//
- ?>
- Ini formnya :
- //-start-//
- <?php echo validation_errors('<div class="alert alert-danger"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>', '</div>'); ?>
- <?php echo form_open_multipart(base_url("admin/pesertadidik/tambah_aksi"), 'class="form-horizontal style-form"'); ?>
- <div class="form-group">
- <label class="col-sm-2 col-sm-2 control-label">Nama</label>
- <div class="col-sm-5">
- <?php echo form_input($nama) ?>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 col-sm-2 control-label">Alamat</label>
- <div class="col-sm-5">
- <?php echo form_input($alamat) ?>
- </div>
- </div>
- <div class="form-group">
- <div class="col-sm-5">
- <?php echo form_input($kirim) ?>
- </div>
- </div>
- </form>
- //-end-//
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement