Hi Mark,

No problem!

There as always are many ways to accomplish this, and this sounds like this will be largely an exercise in Javascript, but on the PHP/SQL side you'll just need to design a table where rows correspond to information that pertains to the whole form (username or ID, title, stuff like that) and then a second table that corresponds to form fields for the form, and are linked via an ID field. I do a similar thing for some shopping cart software that allows the administrator to build custom forms to collect information for particular items for sale. It works pretty well. Is there something in particular you're struggling with or does this help?

The hard part I think will be associating the javascript drag/drop events with information storage in the database. This to me would work well with a small javascript routine that will upon dropping call XMLRequest to a server side script that will update the table immediatly. Then you don't have to mess with some grotesque hidden form madness to keep track of what the user wants.


Mark Fellowes wrote:

Micah, Thanks for the reply. I didn't see it earlier. Also my apologies for the vagueness but right now things are somewhat vauge.

Let me try and explain better:

To start I'll paint a visual to explain it better. Ultimately I know this will require additional tables (will get to that in a moment)

When the page loads, there is going to be a "palette" area where form fields of various types will be sitting. They will not be in a form. The form will sit in another part of the page in it's own div. So to start the table all that should be generated into that palette area will be the form elements (selects, checkboxes, radio buttons, etc). I'm thinking php will be used to pull the markup out of the table and into the palette.

Users can drag and drop form elements into the form. They can edit the elements in there (i.e. length of field, label name, required field, etc). At that point the chosen elements (the ones now in the form) should be pumped back into another table where a name column will save the form intact with all it's elements.

Hope this gives a better idea of what I"m trying to acheive.


-----Original Message-----


Sent: Tuesday, June 20, 2006 4:01 PM -07:00

To: Mark Fellowes [EMAIL PROTECTED]

Subject: [PHP-DB] Generating forms and form elements

Hi Mark,

That's pretty vague, there's probably 1000 ways to do this. Are you just

intending to store the HTML in a text field, or generate the form fields

based on data so that the user can edit the data? Are you storing just

data in the database, or the form structure? Also if it's structure, do

you intend on storing formatting information, or just the form fields


If you sit down and draw up a detailed non-code plan, the solution would

likely present itself.



Reply via email to