We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4172
    • 5,888 Posts
    I think for better answers to eform2db you have to post your questions in the eform2db topic!
    you can try this with eform2db:

    <?php
    function eForm2db( &$fields )
       {
          /*---------------------------------------------------------------      
          eForm2db
          Version: 0.1 [Beta 1]
          Author: pixelchutes
          ---------------------------------------------------------------
          Requirements:
             eForm 1.4+
          ---------------------------------------------------------------
          Use:
             - Takes validated eForm submittal data for use with the MODx DBAPI extender class.                        
             - Easily process database records referencing your form submission data:             
               + INSERT new records to a table of your choice             
               + UPDATE existing records if you'd prefer             
               + DELETE records based on form submittal criteria             
               + Form a query and return its record set as XML using $modx->db->getXML             
               + Query a table's MetaData using $modx->db->getTableMetaData, followed by an update query
                 on only the form fields that are named after table columns!               
               + and much more!
          ---------------------------------------------------------------*/
    
          // Bring needed resources into scope
          global $modx, $table_prefix;
    
          // Init our array
          $dbTable = array(); // key = DB Column; Value = Insert/Update value
    
          // Insert field/value pairs to insert/update in our table
          //$dbTable[name] = $fields[first_name].' '.$fields[last_name]; // Merge two form fields together
          //$dbTable[datetime] = date( 'YmdHis', strtotime( $fields[postdate] ) ); // Massage the postdate timestamp to be MySQL insert friendly
    
          $storefields='region,suburb,centre,street,contact,phone,email,website';
    	  $fieldnames=explode(',',$storefields);
          foreach ($fieldnames as $fieldname){
          	  $dbTable[$fieldname] = $fields[$fieldname];
          }
    
          // INSERT - $dbQuery = $modx->db->insert( $dbTable, $table_prefix . 'insertTableName' );
          // UPDATE - $dbQuery = $modx->db->update( $dbTable, $table_prefix . 'updateTableName' );
          // DELETE - $dbQuery = $modx->db->delete( $table_prefix . 'deleteFromTableName', 'some_field = 1 AND name=\''.$dbTable[name].'\'', '' );
          // etc...
                
          // Run the db insert query
          $dbQuery = $modx->db->insert( $dbTable, $table_prefix . 'members' );      
    
          return true;
       }
       // Return empty string
       return '';
    ?>
      -------------------------------

      you can buy me a beer, if you like MIGX

      http://webcmsolutions.de/migx.html

      Thanks!
      • 14714
      • 84 Posts
      still not importing the data huh

      this is the code for the form ...

      [!eForm2db!]

      [!eForm? &formid=`MembersForm` &noemail=`true` &eFormOnBeforeMailSent=`eForm2db` &tpl=`MembersForm` &gotoid=`57` !]

      and it’s not actually going to the thankyou page also
        • 4172
        • 5,888 Posts
        what do you see when you add the second line to eForm2db ?

        global $modx, $table_prefix;
        print_r($fields);
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
          • 14714
          • 84 Posts
          nothing comes through
            • 4172
            • 5,888 Posts
            perhaps with cached call?

            [[eForm2db]]
              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!
              • 14714
              • 84 Posts
              still nothing