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

Temporary Data in Review Table - Possible?


  1. kingworks
    Member

    Is it possible to have confirm.php send information that does NOT get stored in the actual table?

    My situation:

    A user fills out a form to purchase some tickets, this information includes a credit card number and expiration date - information that I do NOT want to keep in my db.

    I need that info entered and submitted to the credit card processor BEFORE confirm.php/post-functions.php/helper-functions.php send out the confirmation emails. Upon submission, however, I'd like to erase/drop the data. The rest can be treated normally.

    Is this possible?

    I had considered passing the info to another .php file that collects the cc# and exp date after the user submits the information - but that would result in the confirmation emails being sent BEFORE the cc data was collected and passed on.

    Any help or advice is greatly appreciated.

    Posted 16 years ago #
  2. redityo

    Hi,

    You can ignore a form submission saving process by edit "post-functions.php", go to line 1012,you will see this code :

    do_query($query);

    change it to

    if ($form_id <> 1) {do_query($query);}

    but if you are using form review feature, you should go to line 2075 in there you will see this code

    do_query($query);

    you can replace it with

    if ($form_id <> 1) {do_query($query);}

    those code will ignore save process for form id = 1, make sure you adjust the id with yours


    MachForm Support

    Posted 16 years ago #
  3. kingworks
    Member

    Thank you for your reply!

    I am using a form review, so I need to adjust ~2075.

    Using this method, is it possible to specify only certain elements to ignore, or is it an all-or-nothing situation?

    Posted 16 years ago #
  4. kingworks
    Member

    Sorry for the double post. I think I may have a solution. I haven't tested it yet, but I'm hopeful that something similar to the following example will work:

    post-functions.php (line 2056-7)

    $exclude = 42;
    $query = "SELECT * FROM 'ap_form_{$form_id}_review' WHERE $record_id != '$exclude'";

    Posted 16 years ago #
  5. kingworks
    Member

    UPDATE:

    I tried adding an $exclude variable (the element_id of the field I wanted to leave out) and changing the queries on lines 2056, 2075, 2083-90, and 2100 to no avail.

    They all originally ended in:
    . . . WHERE id= '{$record_id}'";

    Which I changed to:
    . . .WHERE '{$record_id}'!='{$exclude}'";

    The credit card number was still showing up in both the review table (not a problem) and the final data table (problem).

    Posted 16 years ago #
  6. redityo

    Hi,

    My code will not save all data to database. But if you only want selected element will not save to database you should ignore my previous code.
    Then edit your "post-functions.php" code and goto around line 2067, you will see this code :

    $columns[] = $meta->name;

    try to replace with this

    if ($meta->name != 'element_1' && $meta->name != 'element_2' &&
    $form_id  == '1')
         $columns[] = $meta->name;

    it will filter element_1 and element_2 in form id 1 to not save in database. also don't forget to adjust the element and form ID first.


    MachForm Support

    Posted 16 years ago #

RSS feed for this topic

Reply