dweeber Posted December 2, 2011 Share Posted December 2, 2011 Been looking to see if anyone has published something like this. I have a number of projects coming up which entail creating input form pages using PHP. Some of these are quite large as to the number of entries, pages etc.. and the worst part is that I know in advance that they most likely will want to change/add to the form after I am done. So rather than coding them physically in the code, I want to define the form elements in an array that I can store in a database/flat file and when the page loads, read from the array to construct the form output. I don't have any issues with dealing with the database or even using arrays, but I have not been able to come up with an array setup that works. Has anyone done this and would care to share the structure they used. Everything that I find on the net is basically sites that want to host the form, but this will be in a non-Internet accessible site so that is not an option. Quote Link to comment https://forums.phpfreaks.com/topic/252328-setup-array-to-define-form-elements-to-generate/ Share on other sites More sharing options...
kickstart Posted December 2, 2011 Share Posted December 2, 2011 Hi How simple will the form designs be? I have written a small system that takes an XML file that defines the input elements and then puts out a series of pages each with those elements on it (final output to save the data was to another XML file). With a limited number of questions per page this is fairly easy to do (doing a VB version of it was far more difficult). The structure including the entered data was just stored in an Object that was stored as a session variable, and once data input was complete it was processed. However this does mean having small and fairly generic input forms. All the best Keith Quote Link to comment https://forums.phpfreaks.com/topic/252328-setup-array-to-define-form-elements-to-generate/#findComment-1293561 Share on other sites More sharing options...
scootstah Posted December 2, 2011 Share Posted December 2, 2011 Off the top of my head: Array ( [0] => Array ( [display] => Username [params] => Array ( [type] => text [name] => username [id] => username ) ) ) Quote Link to comment https://forums.phpfreaks.com/topic/252328-setup-array-to-define-form-elements-to-generate/#findComment-1293570 Share on other sites More sharing options...
dweeber Posted December 2, 2011 Author Share Posted December 2, 2011 ...I have written a small system that takes an XML file that defines the input elements and then puts out a series of pages each with those elements on it (final output to save the data was to another XML file). Keith, Actually, had not really thought of XML for some reason. The forms are pretty basic as they also have to be Accessible (ADA), but there will be sections and pages and required selection fields. .... Need to think about this a bit more. Thanks for the reply. Quote Link to comment https://forums.phpfreaks.com/topic/252328-setup-array-to-define-form-elements-to-generate/#findComment-1293587 Share on other sites More sharing options...
kickstart Posted December 2, 2011 Share Posted December 2, 2011 Hi Will sort out some bits and PM them to you. All the best Keith Quote Link to comment https://forums.phpfreaks.com/topic/252328-setup-array-to-define-form-elements-to-generate/#findComment-1293597 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.