We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4803
    • 20 Posts
    MODx 0.9.6.3
    PHP 5.2.5
    OS Windows Server 2003 (SP 2)
    IIS 6

    One page uses eForm and it works perfectly. The other page uses eForm with the &eformOnBeforeMailSent to call a function with stores the form data in a table, and does not work.

    I tried both the tests mentioned in this thread http://modxcms.com/forums/index.php/topic,13173.0.html and they both worked

    This works perfectly:
    [!eForm? &formid=`tabform` &to=`[email protected],[email protected]` &tpl=`TAB_Form` &thankyou=`TAB_thank_you` &report=`TAB_Report` &from=`[email protected]` &fromname=`TAB Signup` &vericode=`1` !]

    This one does not
    [!eForm? &formid=`recipe_form` &to=`[email protected],[email protected]` &tpl=`recipe_form` &thankyou=`recipe_thank_you` &report=`recipe_email` &from=`[email protected]` &fromname=`Recipe Submission` &vericode=`1` &eformOnBeforeMailSent=`addRecipe` !]

    Below is the snippet to add the information to the database
    snippet with the add recipe function
    This snippet is called from the content before eForm
    if (!function_exists("addRecipe")) {
    	function addRecipe($fields) {
    		global $modx;
    		$recipe = $modx->db->escape($fields['recipe']);
    		//$recipe = mysql_real_escape_string($fields['recipe']);
    		
    		$ingredients = $modx->db->escape($fields['ingredients']);
    		//$ingredients = mysql_real_escape_string($field['ingredients']);
    
    		$instructions = $modx->db->escape($fields['instructions']);
    		//$instructions = mysql_real_escape_string($field['instructions']);
    	
    		$tags = $modx->db->escape($fields['tags']);
    		//$tags = mysql_real_escape_string($field['tags']);
    
    		$submitter = $modx->db->escape($fields['submitter']);
    		//$submitter = mysql_real_escape_string($field['submitter']);
    
    		$table_name = "recipes";
    		$fields2 = array('recipe' => $recipe, 'ingredients' => $ingredients, 'instructions' => $instructions, 'tags' => $tags, 'submitter' => $submitter );
    		$myretval = $modx->db->insert($fields2, $table_name);
    
    
    		if ($myretval) {
        		$fields['recipeID'] = $myretval;
    		     return true;
    		} else {
    		     return false;
    		}
    
    
    		return true;
    	}
    }
    ?>



      • 4803
      • 20 Posts
      problem solved (incorrect e-mail address to a Windows Server e-mail server)

      This discussion is closed to further replies. Keep calm and carry on.