We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26925
    • 44 Posts
    hi,

    I have made a snippet to enter data in modx database ...in the same snippet i call the eform snippet one by one to send emails to different people also...here is the code that I am using:
    function save(&$fields){
    
    	global $modx;
    	$tableArray = array();
    
    	// Initialize the DB Columns Array
    
    	$tableArray['name'] = $modx->db->escape($fields['name']); 
    	$tableArray['email'] = $modx->db->escape($fields['email']); 
    	$tableArray['mobile'] = $modx->db->escape($fields['mobile']); 
    	$tableArray['message'] = $modx->db->escape($fields['message']; 
    	$tableArray['eventurl'] = $modx->db->escape($fields['eventurl']); 
    	$tableArray['keyword'] = $modx->db->escape($fields['keyword']); 
    	$tableArray['ememmail'] = $modx->db->escape($fields['ememmail']); 
    
    	for($count = 1; $count <=5; $count++){
    		$tableArray['ref'. $count .'name'] = $modx->db->escape($fields['ref'. $count .'name']); 
    		$tableArray['ref'. $count .'email'] = $modx->db->escape($fields['ref'. $count .'email']); 
    		$tableArray['ref'. $count .'mobile'] = $modx->db->escape($fields['ref'. $count .'mobile']); 
    	}
    		$dbQuery = $modx->db->insert($tableArray, 'temp_swastika');
    

    Till this step form details are saved in the database ...now i call eform snippet to send emails
    $params = array();
    	$params['to'] = $modx->db->escape($fields['ememmail']);
    	$params['subject'] = 'MobiVite Enquiry : For' . $fields['keyword'];
    	$params['report'] = 'swastika_enquiry_email_manager';
    	$params['formid'] = 'enquiryform';
    	$params['tpl'] = 'swastika_enquiry_form_chunk';
    	$params['fromname'] = 'Mobivite';
    	$params['from'] = '[email protected]';
    	$params['replyto'] = $fields['ememmail'];
    	$modx->runSnippet('eForm', $params);
    	unset($params);
    
    
    
    


    this snippet is perfectly getting called but the next snippet call is just not happening
    . The following snippet call is not executing .(don’t know why)
    $paramseq = array();
    	$paramseq['to'] = $fields['name'];
    	$paramseq['subject'] = 'My MobiVite Enquiry and references: For ' . $fields['keyword'];
    	$paramseq['report'] = 'swastika_enquiry_email_enquirer';
    	$paramseq['formid'] = 'enquiryform';
    	$paramseq['tpl'] = 'swastika_enquiry_form_chunk';
    	$paramseq['fromname'] = 'Mobivite';
    	$paramseq['from'] = '[email protected]';
    	$paramseq['replyto'] = $fields['ememmail'];
    	$modx->runSnippet('eForm', $paramseq);
    	unset($paramseq);
    
    	return true;
    }
    
    
    


    ?>

    Please help........
      • 26903
      • 1,336 Posts
      global modx;
      , shouldn’t this be
      global $modx
      ?
        Use MODx, or the cat gets it!