• PirelliTnz

    (@pirellitnz)


    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/

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