diff --git a/www/application/controllers/Tweet.php b/www/application/controllers/Tweet.php new file mode 100644 index 0000000..6f8945d --- /dev/null +++ b/www/application/controllers/Tweet.php @@ -0,0 +1,29 @@ +load->database(); // load database + $this->load->model('User_Tweets_Model'); // load model + $this->output->enable_profiler(TRUE); + } + + public function index(){ + $this->load->helper('form'); + $this->load->library('form_validation'); + + $data['title'] = 'Create a tweet'; + + $this->form_validation->set_rules('tweet', 'Tweet', 'required'); + + if ($this->form_validation->run() === FALSE) + { + $this->load->view('tweet', $data); + } + else + { + $this->User_Tweets_Model->addTweet(); + $this->load->view('formsuccess'); + } + } +} diff --git a/www/application/models/User_Info_Model.php b/www/application/models/User_Info_Model.php new file mode 100644 index 0000000..fd6b042 --- /dev/null +++ b/www/application/models/User_Info_Model.php @@ -0,0 +1,23 @@ +load->helper('url'); + + $data = array( + 'first_name' => $this->input->post('firstname'), + 'last_name' => $this->input->post('lastname'), + 'email' => $this->input->post('email'), + 'username' => $this->input->post('username'), + 'password' => $this->input->post('password'), + 'location' => $this->input->post('location') + ); + + return $this->db->insert('Users', $data); + } + +} diff --git a/www/application/views/tweet.php b/www/application/views/tweet.php new file mode 100644 index 0000000..1355562 --- /dev/null +++ b/www/application/views/tweet.php @@ -0,0 +1,18 @@ +load->library('form_validation'); ?> + + + +
+ +