WordPress.org

Forums

Contact Form 7
wpcf7_before_send_mail does not work for me (1 post)

  1. frieder94
    Member
    Posted 1 year ago #

    I have a contact form and I want to create a database entry at the same time the contact form emal gets sent. Too try it out I have created a testfunction which looks like this:

    function testfunc( $cf7 )
    {
    mysql_connect("localhost", "user_name", "password") or die(mysql_error());
    mysql_select_db("database_name") or die(mysql_error());
    mysql_query("CREATE TABLE aaaaaaaaaaa ( test VARCHAR(30))") or die(mysql_error());
    }

    This function should only test if the database is editable.

    I also inserted the line add_action( 'wpcf7_before_send_mail', 'testfunc', 1); to run the testfunction.

    The only problem is, that it is not working. When I run the function in a seperate php-file it all works out but within the plugin nothing happends.

    https://wordpress.org/plugins/contact-form-7/

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Contact Form 7
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic