In Save"; $sql="select fieldid from field, tab where field.tabid=tab.tabid and generatedtype=2 and tab.name='Leads';"; // echo $sql; $result = $adb->query($sql); $noofrows = $adb->num_rows($result); for($i=0;$i<$noofrows;$i++) { $lead_id=$adb->query_result($result,$i,"fieldid"); $account_id_name=$lead_id."_account"; $contact_id_name=$lead_id."_contact"; $potential_id_name=$lead_id."_potential"; $account_id_val=$_REQUEST[$account_id_name]; $contact_id_val=$_REQUEST[$contact_id_name]; $potential_id_val=$_REQUEST[$potential_id_name]; if($account_id_val=="None") { $account_id_val=""; } if($contact_id_val=="None") { $contact_id_val=""; } if($potential_id_val =="None") { $potential_id_val=""; } $update_sql="update convertleadmapping set accountfid='".$account_id_val."',contactfid='".$contact_id_val."',potentialfid='".$potential_id_val."' where leadfid=".$lead_id; $adb->query($update_sql); } header("Location: index.php?module=Settings&action=CustomFieldList&fld_module=Leads"); ?>