From e827ec7b45d671303264574d82d08be54cd04e0e Mon Sep 17 00:00:00 2001 From: RameshT Date: Mon, 5 Aug 2024 10:11:20 +0530 Subject: [PATCH] Test Husky pre-commit hook. --- application/controllers/Form.php | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/application/controllers/Form.php b/application/controllers/Form.php index 67d5edd..6ca8937 100644 --- a/application/controllers/Form.php +++ b/application/controllers/Form.php @@ -1,19 +1,28 @@ load->model('Form_model'); } - public function submit() { + public function submit() + { if (!$this->session->userdata('logged_in')) { // If not logged in, redirect to login page redirect('users/login'); } + $form_data = json_decode($this->input->raw_input_stream, true); + $this->load->model('Form_model'); if ($this->Form_model->save_form($form_data)) { $response = array('status' => 'success', 'message' => 'Form submitted successfully.'); @@ -24,13 +33,13 @@ class Form extends CI_Controller { echo json_encode($response); } - public function view($form_id) { + public function view($form_id) + { $data['title'] = $this->Form_model->get_form_title($form_id); - if ($data['title'] === null) { show_404(); // Show 404 if form_id is invalid } - $this->load->view('templates/forms_ui',$data); + $this->load->view('templates/forms_ui', $data); } -} \ No newline at end of file +}