Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Controller: Users.php:
- <?php
- session_start();
- class Users extends CI_Controller
- {
- public function viewinsert1()
- {
- $this->load->view('createfinal');
- }
- public function viewinsert2()
- {
- $this->load->library('form_validation');
- $this->form_validation->set_rules('email', 'email', 'trim|required|valid_email|xss_clean');
- $this->load->view('personalfinal');
- }
- public function viewinsert3()
- {
- $this->load->view('socialfinal');
- }
- public function viewupdate()
- {
- $this->load->view('view_update');
- }
- public function viewdelete()
- {
- $this->load->view('view_delete');
- }
- public function show()
- {
- // $this->load->model('user_model');
- $data['results'] = $this->user_model->get_users();
- $this->load->view('user_view', $data);
- // foreach ($result as $object)
- // {
- // echo $object->id . "</br>";
- // }
- }
- // public function insert()
- // {
- // $username = "Peter";
- // $password = "12345";
- // $this->user_model->create_users([
- // 'username' => $username,
- // 'password' => $password
- // ]);
- // }
- public function insert()
- {
- // echo $this->input->post('password') . "</br>";
- // echo $_POST['username'];
- //echo $email = $this->input->post('email');
- //echo $_SESSION["email"];
- // $email = $this->input->post('email');
- // $_SESSION["email"] = $email;
- // $_SESSION["pass"] = $pass;
- // $_SESSION["cpass"] = $cpass;
- // $_SESSION["fname"] = $fname;
- // $_SESSION["lname"] = $lname;
- // $_SESSION["phone"] = $phone;
- // $_SESSION["address"] = $address;
- $this->load->library('form_validation');
- $this->form_validation->set_rules('email', 'email', 'trim|required|valid_email|xss_clean');
- $this->form_validation->set_rules('fname', 'firstname', 'trim|alpha|required|xss_clean');
- $this->form_validation->set_rules('lname', 'lastname', 'trim|alpha|required|xss_clean');
- $this->form_validation->set_rules('phone', 'phone', 'trim|numeric|required|integer|exact_length[10]');
- $this->form_validation->set_rules('address', 'address', 'trim|alpha_dash|required');
- $this->form_validation->set_rules('pass', 'cpass', 'trim|required|matches[cpass]|md5');
- $this->form_validation->set_rules('pass', 'cpass', 'trim|required');
- if ($this->form_validation->run() == FALSE)
- {
- $this->load->view('createfinal');
- echo "Error";
- }
- else
- {
- $data = array(
- 'email' => $_SESSION["email"],
- 'firstname' => $_SESSION["fname"],
- 'lastname' => $_SESSION["lname"],
- 'phone' => $_SESSION["phone"],
- 'address' => $_SESSION["address"],
- 'twitter' => $this->input->post('twitter'),
- 'facebook' => $this->input->post('facebook'),
- 'googleplus' => $this->input->post('gplus'),
- 'password' => $_SESSION["pass"],
- 'confirm' => $_SESSION["cpass"],
- );
- // echo var_dump($data);
- $result = $this->user_model->create_users($data);
- $this->load->view('createfinal');
- echo "<h1>The data has been inserted</h1>";
- }
- }
- public function update()
- {
- if (isset($_POST['update']))
- {
- $id = $this->input->post('id');
- $data = array(
- 'username' => $this->input->post('username'),
- 'password' => $this->input->post('password')
- );
- $this->user_model->update_users($data, $id);
- echo "<h1> Data is updated successfully:) </h1>";
- $this->load->view('view_update');
- }
- else
- {
- echo "Oops! There is something wrong!";
- }
- }
- public function delete()
- {
- if (isset($_POST['delete']))
- {
- $id = $this->input->post('id');
- $this->user_model->delete_users($id);
- echo "<h1>The data has been deleted.</h1>";
- }
- else
- {
- echo "<h3>No Such data exist!</h3>";
- }
- }
- }
- ?>
- and here is the view that i wanna load..
- createfinal.php:
- <!DOCTYPE html>
- <html>
- <head>
- <title>Login Form</title>
- <link rel="stylesheet" type="text/css" href="<?php echo base_url();?>css/style.css">
- </head>
- <body>
- <!-- multistep form -->
- <form id="msform" action="viewinsert2" method="post">
- <!-- progressbar -->
- <ul id="progressbar">
- <li class="active">Account Setup</li>
- <li>Social Profiles</li>
- <li>Personal Details</li>
- </ul>
- <!-- fieldsets -->
- <fieldset>
- <h2 class="fs-title">Create your account</h2>
- <h3 class="fs-subtitle">This is step 1</h3>
- <input type="text" name="email" placeholder="Email" />
- <input type="password" name="pass" placeholder="Password" />
- <input type="password" name="cpass" placeholder="Confirm Password" />
- <input type="submit" name="next" class="next action-button" value="Next" />
- </fieldset>
- </body>
- </html>
- The css folder is parallel to the application folder. Please help Me!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement