Title: Validation and integration between 2 forms
Last modified: August 24, 2016

---

# Validation and integration between 2 forms

 *  [PirelliTnz](https://wordpress.org/support/users/pirellitnz/)
 * (@pirellitnz)
 * [11 years ago](https://wordpress.org/support/topic/validation-and-integration-between-2-forms/)
 * Hi Michael,
 * First of all great plugin, i am in need of assitance for i am not an experienced
   programmer.
 * I created a form where users register and and in return they get a random 8 digit
   code. This is my pre-registration for an event form. (using contact form 7)
 * After this i created another form for actual registration on the event.
    The 
   thing is i want people that did the pre-registration on line to get there and
   just input their code. After they input their code i want the database to pull
   all the fields from the original pre-registration form and fill the database 
   of the final event.
 * Using your validation code i managed to successfully validate if the code exists
   in the pre-registration:
 * function my_validate_code($result, $tag) {
    $formName = ‘event_form’; // Name
   of the form containing this field $formName2 = ‘preregistration_form’; // Pre
   registration form has unique code $fieldName = ‘ticket-457’; // Field on event_form
   where you input the existing code $fieldName2 = ‘ticket’; // Field on preregistration
   form of the code
 *  $name = $tag[‘name’];
    if($name == $fieldName){ $valueToValidate = $_POST[$name];
   if (is_already_submitted($formName2, $fieldName2, $valueToValidate)) { $result-
   >invalidate($name, ‘Your code is valid’); // error message }
 *  }
    return $result; }
 * // use this if your field is a required fields on your form
    add_filter(‘wpcf7_validate_text’,‘
   my_validate_code’, 10, 2);
 * As you can see i can validate the existance of the code in the previous form,
   but i have no idea how to get the data pulled according to the code to fill the
   new registration database.
 * Can you share some input?
 * regards
 * Santiago
 * [https://wordpress.org/plugins/contact-form-7-to-database-extension/](https://wordpress.org/plugins/contact-form-7-to-database-extension/)

The topic ‘Validation and integration between 2 forms’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/contact-form-7-to-database-extension_ffffff.
   svg)
 * [Contact Form DB](https://wordpress.org/plugins/contact-form-7-to-database-extension/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/contact-form-7-to-database-extension/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/contact-form-7-to-database-extension/)
 * [Active Topics](https://wordpress.org/support/plugin/contact-form-7-to-database-extension/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/contact-form-7-to-database-extension/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/contact-form-7-to-database-extension/reviews/)

## Tags

 * [cfdb](https://wordpress.org/support/topic-tag/cfdb/)
 * [validate](https://wordpress.org/support/topic-tag/validate/)

 * 0 replies
 * 1 participant
 * Last reply from: [PirelliTnz](https://wordpress.org/support/users/pirellitnz/)
 * Last activity: [11 years ago](https://wordpress.org/support/topic/validation-and-integration-between-2-forms/)
 * Status: not resolved