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

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 3

php embedded code redirect to website option how to get form values


  1. aes
    Member

    First of all thank you so much for providing this tool! I had spent a week searching around for form editors to help me with the project I am working on and finally came across your solution. :-)

    Anyways, I have a large multi-page form that I need to process after the submit button is pressed which I assume will call the redirect to weblink URL. I then need to extract the values filled into the form (I suspect using some form of $SESSION and $_POST call) and add them to my MySQL data table as a new entry.

    1. How do I find out what the form field names are?
    2. What is the best way to extract the information?

    Al

    Posted 10 years ago #
  2. aes
    Member

    Ok so after looking at what happens when a form is filled out, I noticed that it seems that an entry into the table ap_form_<form number>_review is created, but the fields from the form have non meaningful names like element_1_1 etc. How can I change the form output in this table to be names that make more sense to the data I am trying to represent?

    I don't think I can just rename the column names in the *_review table can I?

    Posted 10 years ago #
  3. aes
    Member

    After a lot of searching around the forums it sounds like there is no easy way to modify the sql database that the form inputs go into so the columns have meaningful names.

    I am thinking that I will have to somehow:
    1. Figure out what the different element_ names map onto in my form? Any suggestions on an easy way to do that?
    2. Copy the data out of the table into my real database that has these meaningful column names in it. Anybody have sql code or algorithms to share on how to do this?
    3. I ultimately need to have the entered data correlate to the user that is logged in and entered it as well. Any suggestions on how to have that info automatically entered into the form?

    Posted 10 years ago #
  4. yuniar

    I'm afraid what you are doing is not an easy task to do, at least in this current version. Sorry.
    Those element_xxx names refers to each field within your form, where xxx is the field id number.

    You can do a lookup to "ap_form_elements" table to see the relation of those id numbers with the form fields.

    We'll be releasing v4 soon and one of the new functionality will be webhooks. Webhooks will allow you to post your form field data to any other URL or system, to further process the data.


    MachForm Founder

    Posted 10 years ago #
  5. aes
    Member

    What does releasing v4 soon mean exactly? I am trying to decide if I need to ask for a refund and give up on this or wait for V4?

    I need to have my form inputs working very soon. I am trying to avoid having to hand code every form input.

    Posted 10 years ago #
  6. aes
    Member

    Ok lets suppose I go with the brute force method and find all the label names and edited the sql databases associated with the form so the names matched meaningful ones for my application after creating a form. Will it be able to be edited using MachForm after I make these changes (assuming I get them right)?

    Posted 10 years ago #
  7. aes
    Member

    BTW if V4 is close to done, I would be willing to beta test it.

    Posted 10 years ago #
  8. aes
    Member

    BTW I found what I was after. I looked at the form that MachForm created on my browser showing the source and made note of the labels it used for each field. I then added:
    $_SESSION['post_data'] = $_POST;

    just before the:
    require("/mysite/machform-test/machform.php");

    line in the embedded php form code created by machform.

    Then when I redirect the URL I can query each element like so
    $_SESSION['post_data']['element_n']

    The solution was mostly extracted from this post:
    http://www.appnitro.com/forums/topic/need-to-get-form-data-after-form-is-submitted-_post?replies=13

    Posted 10 years ago #
  9. aes
    Member

    Does this $_SESSION technique not work if the form has multiple pages?

    Posted 10 years ago #
  10. carlkarcher
    Member

    Since this post was pre-V4 and webhooks, could we have an example of how to get form variables to a redirected php page using webhooks?

    Thanks.

    Posted 10 years ago #
  11. yuniar

    carlkarcher -- as of v4, you can construct the Redirect URL dynamically using template variables. This way, you can easily pass any of your form field values to the redirected PHP page.

    For example, you could use redirect URL like this:
    http://www.example.com/mypage.php?name={element_1}

    In this sample, {element_1} will be replaced with an actual value of the field within the form.
    You can then parse the $_GET['name'] from your PHP page.


    MachForm Founder

    Posted 10 years ago #

RSS feed for this topic

Reply