programmher
Programmer
I need to allow my users to create their own field names. The users are limited to 2 choices (i.e. - City, State). My problem is that as the user creates the new fields, I need the database to convert the field names to "City1", "State1", "City2", "State2", etc. The list and combinations of cities and states could be as short as one or as long as 99999.
Will an array accomplish this for me? If so, do I reference the array in my query that updates the database?
Here is what I have so far: (This does not perform ANY of the dynamic numbering, etc.)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<form action="AddingFields.cfm" method="post">New City:
<input type="text" name="New City">
<br>
<input type="button" value="add it now">
</form>
<cfquery name="addmynewfield" datasource="MyDatabase">
ALTER TABLE tbl_City
ADD NewCity1 VARCHAR(50) NULL
</cfquery>
I would appreciate ANY insight!
Will an array accomplish this for me? If so, do I reference the array in my query that updates the database?
Here is what I have so far: (This does not perform ANY of the dynamic numbering, etc.)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<form action="AddingFields.cfm" method="post">New City:
<input type="text" name="New City">
<br>
<input type="button" value="add it now">
</form>
<cfquery name="addmynewfield" datasource="MyDatabase">
ALTER TABLE tbl_City
ADD NewCity1 VARCHAR(50) NULL
</cfquery>
I would appreciate ANY insight!