This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 2

Where add a call to a PHP script when a form is submitted


  1. jpdupont
    Member

    Hello,
    I want to call a php script each time a form is correctly submited, to update a table.
    Where put this call?
    Thanks.

    Posted 16 years ago #
  2. yuniar

    Edit your hooks/custom_hooks.php and insert this block of code:

    function formXX_hook_post_insert($user_input){
    	/** put your custom code here ** /
    }


    Replace XX with your form id number.
    $user_input would contain all your form data.

    So, for example you have form with id = 2, the code would be something like this:

    function form2_hook_post_insert($user_input){
    	do_query("update mytable set sample_field='{$user_input['element_5']}'");
    }


    Let me know if you have any question.


    MachForm Founder

    Posted 16 years ago #
  3. jpdupont
    Member

    Thanks!

    Posted 16 years ago #

RSS feed for this topic

Reply