WordPress.org

Support

Support » Plugins and Hacks » Insert Data from Multiple Contact Form 7

Insert Data from Multiple Contact Form 7

  • sanketzalak
    Member

    @sanketzalak

    I Use

    add_action('wpcf7_before_send_mail','save_to_the_database');
    function save_to_the_database($cf7) {
    		global $wpdb;
    		//declare your varialbes, for example:
    		$id = $cf7->posted_data["id"];
    		$first_name = $cf7->posted_data["first-name"];
    		$email_txt = $cf7->posted_data["email-id"];
    
    		//echo $ticket_id;
    		$result = $wpdb->get_results( "INSERT INTO databasename (<code>id</code>, <code>firstname</code>, <code>emailid</code>) VALUES ('$id','$first_name','$email_txt')");
    	}

    Its work fine.

    Now I have Three Contact Form, contact-form-7 id="411" contact-form-7 id="412" and contact-form-7 id="413"

    How can I trigger
    If id of form = 411, Insert into DB -> Table1
    If id of form = 412, Insert into DB -> Table2
    If id of form = 413, Insert into DB -> Table3

    http://wordpress.org/extend/plugins/contact-form-7/

  • The topic ‘Insert Data from Multiple Contact Form 7’ is closed to new replies.