Hi Friends,

I am working on php from builder, where user can add text-box, text-area, chekbox, radio-button etc field using jQuery.
Now i am ready with html code of form. Next step is to save each attributes(i.e. name, optionstags, label, title, tooltip, class etc) in mysql database.
How can i store each values in database using jQuery or PHP ?
I have checked jquery serialized function but that will just return values of input field.
Need your help or suggestions guys.


Recommended Answers

All 5 Replies

you need a php page to process the input.

Now, you need to add name attribute to each of your tag.

then, you use the get or post method ....

This is actually the basics of php. I suggest you start learning it via tutorials etc..

commented: This is not related to question.. -2
Member Avatar

Not knowing your DB setup, I'd probably go at it in this way:

attr_id (PK)
formfield_id (FK)
attribute_name (FK or enum) - use FK if you want a table of possible attributes
attribute_value (text - as you may have long js for 'on*' attributes)

formfield_id (PK)
form_id (FK)
(other table fields)

form_id (PK)
(other table fields)

I don't know if that's any use?

@ardav: thanks for db setup.
But i am looking for some different point.

for example take a look on this link : http://www.phpform.org/formbuilder/index.php
Here i can create dynamic form by adding fields from top.
Now i want to save all created form fields, labels, values to database.
How can i post all values to php page.bcz form will only post input field name and values.
But i need labels, attributes, options of dropdown ..etc.

I think you must save html code for each element in database. For example you keep few default input element in database say (id, html_code)

Populate all id with html_code on left side as sample, so when some one click any id button. copy corresponding code to your new design division.

In jquery you will easily find inner html to save in database.

I hope I am on the right track.

Okay.. i end up with this logic.
There is one hidden field named form_html. When admin click on save button using jquery i am getting html inside form tag and setting it in hidden variable.
After submitting in php side i have used one html parser class, which will filter all attributes and saving it into database.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.