Can anyone point the way to a form-builder written in PHP? The basic idea is that I'd like to find a tool that allows an authorized user to build a form and publish it on their site.

Ideally, the form would handle the construction of appropriate data structures to store the data (I'm thinking MySQL tables) and would also allow the user to specify javascript and/or php input validation.

Does any such tool exist? I've seen a form builder for Drupal but it is dated June 22, 2006 and has a big warning: "This project is not yet ready for use in a production environment." I've posted this same question on their forums with no response yet.

I've also seen super-primitive wordpress form builders but they are not really any good.

I'm open to pretty much anything here. Raw PHP. Joomla. Drupal. whatever. Any suggestions would be most welcome.

    look at survey creation tools, as that's form creation and data storage, you can strip out pretty graphics if you don't need them

      I had to build something for a client recently. They had one but it was over 10 years old and certain parts had just stopped working. They. like yourself, had also looked but not found anything that would work, and they were willing to pay.

      Now do to their absolute lack of any kind of programing skills it is not something that is worth distributing. But it really it isn't to difficult to build one.

      Think about it there is 5 basic types of fields; input, select, checkbox, radio, and textarea. So the user selects the type, and gives it a name. You then let them set a default value, and the fields size.

      Then to validate is not difficult. In both php and javascript you create a few basic functions, like an email validation function, a password validation function, a length validation function, and a function to check if checkboxes or radio buttons are selected. And you let the user select if they want to validate a particular field or not and how.

      Then to validate in Javascript you can loop through elements by their tag name. If an element needs validation you can add non-standard attributes like

      <input type="text" id="fieldid" name="fieldname" value="somevalue" class="mycss" data-required="yes" data-length="5" />
      

      These are supported in HTML 5 but HTML 4 just ignores them but javascript can access them with getAttribute.

      To validate in PHP is much simpler as you plan to store all the field names in a database, the validation requirements can be stored with them.

      Its is quite simple I built the one in just a few days. Of course something a bit more flexible may take a bit longer but it would not be difficult.

        yes - agree with Krik
        I had to do one for a client right at the end of a project and I was expecting it to be a lot of work - but exactly as Krik says it really wasn't so hard -
        there's nothing that's not routine in there..
        (PHP validation only - no js )
        it then made adding a new form to the site, a 5 minute job

        my plan is to recycle it for another project and add js or ajax via jquery

        a lot of the fine tuning will be cms text options like:
        add caption before / add caption after
        add line above / add line below
        add note text etc etc

          I really appreciate the info you guys. Any thoughts on automatic creation of db tables to store this info? Would you you have some kind of one-table-handles-all situation or would you be creating a custom SQL table for each form?

          I'm imagining a system where we have something like a DataPoint which has a form input, some validation, maybe some permissions associated with it. I'm imagining one might have many DataPoints associated with a DataForm object. In this case I can imagine some sql tables like data_points, data_forms, and data_values.

            I would think you would want to have a table that stores each forms name.

            Then a second table would stores the user defined values for each field with a reference to the unique id of the form it belongs to.

            Then a third table that stores submitted data.

            And then create a fourth table that ties those three together.

            It seems like a waste to create a new table for every form when all it would do is store the values from a submitted form. You have to create the first 2 tables no matter what. So there is no reason to not continue using their data and then just relate it to the submit info. A new table for each form technically means duplication of already stored data.

            Now if you anticipate huge amounts of submitted data, per form, you may want to split them up. But at that point I would think the entire approach may need to be rethought.

              yes I did it the same way
              -only needed three tables - one for master form (form name, intro text etc)
              one for input fields ( field type, required or not, error message , comma delimited list for dropdown, checkboxes,etc)
              then a table for the responses

                Write a Reply...