Jump to content

trying to insert values according to select values


narjis

Recommended Posts

I have a table having enum values and now i'm trying to insert and update the values according to the select values. It is not updating . Is is possible to update the values according to the form selection. Here is my code:


<select name="task_type"  id="task_type" class="chzn-select" style="width:250px">
                            <option value="0">Select Task Type</option>                       
                            <option value="1">Controlled</option>
                            <option value="2">Simple</option>
                            <option value="3">With Notification</option>
                            <option value="4">Collabration</option>         
                            <option value="5">Periodically</option>         
                            <option value="6">Once</option>         
                            <option value="7">Note</option>                                              
                        </select>

 

 

and Here is the way I'm updating in the database;



		$table = user_tasks;
		$data = array(
			'portal_id' => $portal_id,
			'company_id' => $company_id,
			'user_id' => $user_id,
			'parent_id' => intval($_POST['parent_id']),
			'assigned_to' => sanitize($_POST['assigned_to']),
			'title' => sanitize($_POST['title']), 
			'task_type' => sanitize($_POST['task_type']),
			'description' => sanitize($_POST['description']),				
			'status' => sanitize($_POST['status']),
			'file_name'=> sanitize($_FILES['file_name']['name']),
			'task_end_date' => sanitize($_POST['timetask']),
			'repeat' => sanitize($_POST['repitition']),
			'date_updated' => date('Y-m-d H:i:s')
		);

($this->id) ? $db->update($table, $data, "id='" . (int)$this->id . "'") : $db->insert($table, $data);
		$message = ($this->id) ? "Task Updated Successfully" : "Task Added Successfully";

 

 

Actually I didn't understand they way enum column can be updated now I've found the solution that enum values are stored in the form of index starting from 1. they can be updated in the very same manner.

Thanx anyway.

The fact that it's an ENUM has absolutely no bearing on updating the values.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.