function my_cforms_action($cformsdata) { $formID = $cformsdata['id']; $form = $cformsdata['data']; $aff_id = $_COOKIE['ap_id']; $ipaddress = $_SERVER['REMOTE_ADDR']; $clientdate = (date ("Y-m-d")); $clienttime = (date ("H:i:s")); /* change ['Email *'] to match the email field in your form */ $buyer_email = $cformsdata['data']['Email *']; /* change ['Your Name *'] to match the Name field in your form. */ $clientname = $cformsdata['data']['Your Name *']; /* I have 2 forms on my site, a contact and a request a quote form, so I use the form name to identify the source of the referral, in cforms II the first formID is blank so if you used or modified the default form the id is blank (apparently there is no formID 1)*/ if ( $formID == '' ) {$reference = 'FIRST FORM NAME';} else if ( $formID == '2' ) {$reference = 'SECOND FORM NAME';} global $wpdb; $affiliates_leads_table_name = $wpdb->prefix . "affiliates_leads_tbl"; $updatedb = "INSERT INTO $affiliates_leads_table_name (buyer_email,refid,reference,date,time,ipaddress) VALUES ('$buyer_email','$aff_id','$reference','$clientdate','$clienttime','$ipaddress')"; $results = $wpdb->query($updatedb); }