Appnitro Software Forums » MachForm

adding new field to database

(3 posts)
  • Started 7 months ago by jerbourq
  • Latest reply from jerbourq

  1. jerbourq
    Member

    Hello,

    I`m trying to modify the functionality of machform to include another field to the ap_form table. I saw something similar to this in the forum.

    So in the edit_form.php file I add this.
    if(!empty($row)){
    $form->id = $form_id;
    $form->name = $row['form_name'];
    $form->description = $row['form_description'];
    $form->redirect = $row['form_redirect'];
    $form->success_message = $row['form_success_message'];
    $form->password = $row['form_password'];
    $form->frame_height = $row['form_frame_height'];
    $form->unique_ip = $row['form_unique_ip'];
    $form->captcha = $row['form_captcha'];
    $form->review = $row['form_review'];
    $form->newfield = _session['newfield']
    }

    The new field doesn't have to be entered by the user. It should come from session data and be added to every new form so I can keep track of who's creating a form. I know the function required is in javascript and the javascript is obfuscated so i'm wondering if there's a function call that I would need to add newfield to the database table ap_forms.

    Can you lead in the right direction. Thank you very much for your helpo.

    Posted 7 months ago #
  2. This one is pretty simple actually. You only need to modify save.php file.
    Let say your field name is form_creator

    Search around line 82 - 91 of save.php, you should see this:

    $form_input['form_id'] 			    = $form_id;
    $form_input['form_name'] 			= $form_object->name;
    $form_input['form_description'] 	= $form_object->description;
    $form_input['form_redirect'] 		= $form_object->redirect;
    $form_input['form_success_message'] = $form_object->success_message;
    $form_input['form_password'] 		= $form_object->password;
    $form_input['form_unique_ip'] 		= $form_object->unique_ip;
    $form_input['form_captcha'] 		= $form_object->captcha;
    $form_input['form_review'] 			= $form_object->review;
    $form_input['form_frame_height'] 	= $form_object->frame_height;

    right below those lines, add your own line:

    $form_input['form_creator'] 	= $_SESSION['user_name'];
    Posted 7 months ago #
  3. jerbourq
    Member

    thank you very much, worked like a charm .

    Posted 7 months ago #

RSS feed for this topic

Reply

You must log in to post.