2024-07-12 11:50:41 +00:00
|
|
|
|
|
|
|
<?php
|
|
|
|
|
2024-08-09 12:04:48 +00:00
|
|
|
class Create_model extends CI_Model
|
|
|
|
{
|
|
|
|
public function details()
|
|
|
|
{
|
2024-07-12 11:50:41 +00:00
|
|
|
// Retrieve user_id from session
|
|
|
|
$user_id = $this->session->userdata('user_id');
|
|
|
|
|
|
|
|
// Prepare data to insert into forms table
|
|
|
|
$data = array(
|
|
|
|
'user_id' => $user_id,
|
|
|
|
'title' => $this->input->post('title'),
|
|
|
|
'description' => $this->input->post('description')
|
|
|
|
);
|
|
|
|
|
|
|
|
// Insert data into forms table
|
|
|
|
$this->db->insert('forms', $data);
|
2024-07-15 12:45:25 +00:00
|
|
|
|
|
|
|
// Store form_id in session
|
|
|
|
$formId = $this->db->insert_id();
|
|
|
|
$this->session->set_userdata('form_id', $formId);
|
|
|
|
|
2024-08-09 12:04:48 +00:00
|
|
|
return $formId;
|
2024-07-12 11:50:41 +00:00
|
|
|
}
|
2024-07-15 12:45:25 +00:00
|
|
|
}
|