The below simple php function is used to update data into MySql database with out manually filling the update mysql query with input filed names. Function: function update_Defined($table, $data, $condition){ // update('table', array_map('trim',$_POST),'id='.$_POST['p_id']); global $db; $query = "UPDATE `" . $table . "` SET "; $fis = array(); $vas = array(); foreach ($data as $field => $val){ $fis[] = "`$field`"; $vas[] = "'" . mysqli_real_escape_string($db,$val) . "'"; } foreach ($fis as $key => $field_name) { $fields[$key] = $field_name; if (isset($vas[$key])) { $fields[$key] .= '=' . $vas[$key]; } } $query .= implode(',', $fields); $query .= " WHERE " . $condition; //echo $query;exit; Query($query); } Form: <form action="" method=