I need MySQL Schema for form generation system, I have created form designer but i need to store it in MySQL.
This system can do following
Create your own form
Add or remove as much fields as you want
Form will connect to a MySQL Table which is going to store form submission data
How it can be done, plz help me
Try using the Entity-attribute-value model (EAV).
Example table for form data:
ID
Name
Value
So for a form with 5 fields, each form would have 5 rows. Name would be the fieldname, value the filled in value.
Related
I'm new to Symfony and I would like your help in deciding the best way to design a form and store into database using Doctrine. Here is my task:
I have a form created with the FormBuilder containing various types of input fields. I have created entity which connects my database to form and it works both ways, both to fetch data and to put data into database.
However, I want to add a Select multiple field to a form which would be populated from a table from the database. And when I select the choices from that select element, I would like to save them into a database in either csv of id's or some simple serialized object or array.
So far, what I have managed to do is to add that Select field as EntityType and have placed ORM Annotation in entity for that element: Type("object"), which populates the Select element flawlessly. From the $_REQUEST variable I can see that it returns the id(s) of selected options. But, what I get when I submit the form is a very large serialized object in the field which is supposed to store selected element.
I suppose that it is a normal behavior (to store the entire object (an entire row of data)), but is there some cleaner, leaner way of storing only the id's that I would be able to later on use to populate the same select field, also using doctrine (since I don't have a need for other data in that field except for their IDs)?
Thank you in advance.
I'll try to explain my problem and let´s see if I get some help.
I`m trying to design a DB. This data base will contain users and forms but my problem is how to design it to save forms.
The forms will be created by the administrator when he needs them, so in the DB I have a table to save the form name. Another table with all the possible fields for all the forms and another table where form-names and fields will be save so I can see all the field that a determinated form has.
An example: In FormName table I have 3 form names: Personal Info, Computer Knowledgement and hobbies. And in Fields table I have, for example, Name, Address, Phone, Operating Systems, Programming, Bike ridding, playing pc games.
I decide to create a form with name number 1 (Personal info) and fields number 1,2,3 (Name, Address, Phone). This information is recorded in another table called full-form where it´s saved form name id and field id. This is pretty clear for me (perhaps I´wrong).
The tricky part comes now. Some user decide to fill the personal info form so the name of the form and each field will has to displayed. When the user fill the form it has to be saved some way so the administrator can see the name of the form, each field that that form has, who filled the form and the information written in each field. And all this should be displayed not only in the DB but in some different way like a table, for example.
By the way... I´m using cakephp and mysql.
Thanks in advance,
Abraham
As far as I understand, setup looks like this. As you said, we have 3 tables:
'formname' = id, name (for form names)
'formfields' = id, fieldname, attributes (for form names, added attributes in case you need them)
'forms' = id, formname_id, formfields_id, formfields_order (ready forms and possibility to order field in form)
And also you should create additional table where to store submitted values
'forms_values' = id, forms_id, value (in this case one row for each field)
If you want to relate those values to specific user, one more table should be created
'users_forms' = forms_values_id, user_id
Of course there should be users table as well.
My suggestion is to drop table 'formnames' and put form name in 'forms' table.
Then table 'forms' will contain
id, form_name, formfields_id, formfields_order
Hope this answer will put you forward :)
I have two tables:supa and acts. Supa table has ID as primary key and and Acts table has supa_ID as a foreign key that is connecting this tables.
Now in table Supa I has field that is called "oznaka".
I suppose to create text field where I will put "oznaka", but in background it is suppose to take ID of Supa table, connect with table Acts, find supa_ID and put him there.
I have troubles with controller function - I suppose I use view - controller only. This doesn't suppose to be hard but I have really trouble :(
<?php echo $form->dropDownList($model,'item_type_id', CHtml::listData(ItemType::model()->findAll(), 'id', 'type'), array('empty'=>'select Type')); ?>
This is basic usage in Yii to create dropdown list, populated from database.
If You want text box, You can make ajax call after some input is received to check whether in database is something that corresponds to this input. If there is, add new value to some hidden input field and get that data when form is sumbitted, in controller.
I need to make a form to retrieve values from database. The form will have a date field AND/OR drop-down and a row of three fields as default. The user can add/remove extra rows as per required.
The three fields are:
drop-down with options as table name from db(eg. employee_name,vehicle_name etc)
drop-down for conditions (like/equal-to/greater-than etc)
text-box where user can input data (eg. ford,suzuki etc).
How can I make a form where I can add/remove fields as required and then retrieve the values through a PHP code and use that as query to select and display appropriate values from database?
I use PHP Codeigniter method to build this custom search form.
form image
I have a table which is populated by values obtained from mysql database. I want to use an ajax call function so that when I click a cell - based on the cell value the textboxes get filled. Now the data in the textboxes will be from another table in the mysql database.
So an example of how it would work is:
I have one table for credentials, which shows user name and their user id.
On the website this is shown as a table. Now when i click the a cell which has a user name. The textbox would be populated by the users say total exams taken which is obtained from exams table in the mysql.
I am totally stumped on how to go about doing this. Please can someone help!
You can do this by using ajax .
use this
$("#cell").click(function(){
$.get("file.php?id="+$(this).val(),function(data){
$("#textboxid").val(data);
})
})
the file.php is the file which will perform the back-hand calling to database and make a output.