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";

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.