Welcome Guest, Not a member yet? Register   Sign In
Form Generator
#1

[eluser]Seller[/eluser]
Hello. Apologize for my bad English. I am developing a site on the similarity http://www.alibaba.com/. On this website when placing a new ad., depending on the selected subcategory dynamically generated form with the characteristics of the selected categories. For example, if a person has chosen a category Computer Hardware & Software and subcategory Laptops, then for this subcategory is generated form with features for Laptops. Just these characteristics are associated with the search product, such as a person has entered into a search form Laptops, then on the search page appears characteristic of this section as filters to refine your search.
I made 4 of the table to store the fields. First table fields (id, title, type) the second fields_values (field_id, good_id, value) third fields_groups (id, title) and the fourth table in which we write what fields belong to which group fields_in_group (group_id, field_id ) and to each category of the directory I can attach some group of fields. But I have a problem now. How can I store the values for option and bind them to a select field? I have thought that if we make another table to store values and the option to link this table on the ID of the table fields. Please, tell me! Am I in right direction think?
#2

[eluser]adityamenon[/eluser]
That's pretty deep. I understood your problem, but can you post a diagram of your MySQL schema here? That would help me understand your solution better; and suggest any improvements if necessary.
#3

[eluser]Seller[/eluser]
[quote author="adityamenon" date="1307604429"]That's pretty deep. I understood your problem, but can you post a diagram of your MySQL schema here? That would help me understand your solution better; and suggest any improvements if necessary.[/quote]

The scheme of my tables. Graphic diagram in the attachment
Code:
table `fields`
+-------+------------------+------+-----+---------+----------------+
| Field | Type             | Null | Key | Default | Extra          |
+-------+------------------+------+-----+---------+----------------+
| id    | int(11)          | NO   | PRI | NULL    | auto_increment |
| title | varchar(128)     | NO   |     |         |                |
| type  | varchar(128)     | NO  |      |         |                |
+-------+------------------+------+-----+---------+----------------+

table `fields_values`
+---------+------------------+------+-----+---------+--------------+
| Field   | Type             | Null | Key | Default | Extra        |
+---------+------------------+------+-----+---------+--------------+
| id      | int(11)          | NO   | PRI | NULL    |              |
| good_id | int(11)          | NO   |     |         |              |
| value   | varchar(128)     | NO   |     |         |              |
+---------+------------------+------+-----+---------+--------------+


table `fields_groups`
+-------+------------------+------+-----+---------+----------------+
| Field | Type             | Null | Key | Default | Extra          |
+-------+------------------+------+-----+---------+----------------+
| id    | int(11)          | NO   | PRI | NULL    | auto_increment |
| title | varchar(128)     | NO   |     |         |                |
+-------+------------------+------+-----+---------+----------------+

table `fields_in_group`
+----------+-------------+----------------+-----------+---------------+
| Field    | Type        | Null   | Key   | Default   | Extra         |
+----------+-------------+--------+-------+-----------+---------------+
| group_id | int(11)     | NO     | PRI   |           |               |
| field_id | int(128)    | NO     |       |           |               |
+----------+-------------+---------+------+-----------+---------------+


table `menu`
+---------+------------------+------+-----+---------+--------------+
| Field   | Type             | Null | Key | Default | Extra        |
+---------+------------------+------+-----+---------+--------------+
| id      | int(11)          | NO   | PRI | NULL    |auto_increment|
| name    | varchar(255)     | NO   |     |         |              |
| par     | int(11)          | NO   |     |         |              |
+---------+------------------+------+-----+---------+--------------+
#4

[eluser]Seller[/eluser]
Hello. Maybe I do not quite understand explained to me what my problem now. Try again. The database will store all possible form fields for each category of goods. But I can not figure out how to store a database "<select>" and "<option>" (dropdown list). Please help very urgently need a solution.




Theme © iAndrew 2016 - Forum software by © MyBB