• Hello,
    in my form I have

    [date visit1_date id:visit1_date placeholder "yyyy-mm-dd"]

    Now, I’m trying to insert into a DB table this value:

    CREATE TABLE IF NOT EXISTS xxxx_mypers_visits (
    ...
      visit_date date NOT NULL,
    ...
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1;

    PHP:

    <?php
      function my_conversion( $wpcf7_data ) {
         global $wpdb;
         if ( $wpcf7_data->id == 1073) {
                     $table_name = $wpdb->prefix . "mypers_visits";
                     $wpdb->insert($table_name, array(...,
                                                      "visit_date" => $wpcf7_data->posted_data["visit1_date"],
                                                      ...),
                                                array(..., "%s", ...));
              }
          }
          return $wpcf7_data;
      }
      add_action('wpcf7_before_send_mail', 'my_conversion');
    ?>

    When I run the code the date inserted is 0000-00-00.
    Can anyone help me?

    Riccardo

    https://www.ads-software.com/plugins/contact-form-7/

    [Moderator note: Please don’t bump]

  • The topic ‘Input date and DB’ is closed to new replies.