Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID

forms + user registration

edited February 2013 in Apps

I wish that when sending a form (made with forms app), a new user is inserted in user table with default type.

Obviously, in the form there are the required fields (name, email, password).

I started adding form/submitted[] = form-action/handler at the end of /conf/config.php then I created the file /apps/form-action/handlers/handler.php but I have not figured out how to recognize the calling form and how to retrieve data.

Thanks for any help.

Comments

  • In your handler.php, you should have a $data array that looks like this:

    $data = array (
        'form' => 123,
        'values' => array (
            'field_name' => 'Some value',
            'field_two' => 'Another value'
        )
    );
    

    The values array keys will be the fields from your form. To see what values you have, you could try something like this:

    <?php
    
    file_put_contents ('cache/_form_values_.txt', json_encode ($data));
    
    ?>
    

    Then take a look at the cache/_form_values_.txt file to see the full data structure with all of the field names.

  • It seems that the handler is not called.

    What am I doing wrong?

  • Hmm, not too sure. Here are the steps I used that worked for me:

    https://gist.github.com/jbroadway/4978476

  • I put form/submitted[] = form-action/handler at the end of the file and not in the "Hooks" section .

    Solved, thank you.

Sign In or Register to comment.