I want to use some of the fields in the form of "TYPE =" TEXT as an array.
#########what you are asking for##########
If you mean the field set as text are supposed to help you capture an array of items,
eg in workitems you want to store item_1,item_2,item_3, any maybe in workitems you want to store item_1,item_2,item_3
Then simply set the text fields to use a checkbox controll, which either has a defined list of items to pick from or uses lookup table to pick the list of items to pick from.
You can even set use modal dialog suc that a user can serac for an option to tick if they are many checkboxes
#########what you are asking for##########
#########WHAT I THINK YOU REALLY NEED TO DO##########
NOTE:In your replies I feel you might be approaching it wrong eg
-You dont mention anything about your original question(Add Remove Input Fields Dynamically)
- You want to store priceperunit and unit as text yet they should be number formats
Basic on your Inititla approach If some sort of relation exists between the different array values selected by user in each input box
for example if a user sets
workitems = rice,bananas
unit = kgs, pieces
priceperunit = 3000,4000
And You want this to mean or would like later on to present it as
-rice costs 3000 per kg
-babansa cost 4000 per piece
Then this kind or relationship will be hard to formulate if they are all entered as arrays in multiple fields all in one table.Then you might want to create separate tables for them
If you want it to appear like you have drawn it on the form where one Subject of the treaty can have multiple collections of (workitesm and price per unit), multiple collections of general conditions and multiple collections of private conditions.
With an option to add more collections to any of those. as welll as remove a collection from them
Then your current table structure can not bring out that relationship. You need to design table structures that allow for the dynamic setup that you want to achive, for as long as an entity can appear multiple times for another entity then it deserves its own table.
Then you need it setup like one below:
CREATE TABLE subjectofthetreaty (
id bigint(20) PRIMARY KEY AUTO_INCREMENT,
name varchar(50)
)
ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE workitems (
id bigint(20) PRIMARY KEY AUTO_INCREMENT,
subjectofthetreaty_id bigint(20),
name varchar(50),
unit float,
priceperunit float,
FOREIGN KEY (subjectofthetreaty_id) REFERENCES subjectofthetreaty(id)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE general_conditions (
id bigint(20) PRIMARY KEY AUTO_INCREMENT,
subjectofthetreaty_id bigint(20),
name varchar(50),
FOREIGN KEY (subjectofthetreaty_id) REFERENCES subjectofthetreaty(id)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE private_conditions (
id bigint(20) PRIMARY KEY AUTO_INCREMENT,
subjectofthetreaty_id bigint(20),
name varchar(50),
FOREIGN KEY (subjectofthetreaty_id) REFERENCES subjectofthetreaty(id)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
NOTICE how all the other netities reference the main one.
Now If you connect them to phpmaker and setup master/detail relationship approriately (read about it in help menu)
enable master/detail add and edit, you should have a form that looks exactly like you want.
#########WHAT I THINK YOU REALLY NEED TO DO##########