I've created a dynamic form which allows you to modify the amount of input fields you need. This is because they may have 15 band members and need 15 fields, or one band may have 2. The only I problem I have is when submitting the form, each input is named as "memberName1", "membername2" etc. which is done using jQuery. How would I run a check while/before running the query to see if those fields are filled and if they are to input their values into the database? Thanks.
EDIT 1:
I was thinking something like the code below. But I would need to run a loop to count through all the present fields where the name is memberName
, followed by a number. Rather than stopping at the first empty field, run through them all. If the value is blank do nothing. If it's got a value then insert it into my table.
<cfquery datasource="exampledatasource" name="insertbandmembers">
Insert Into members(members_name)
Values (memberName#i#)
</cfquery>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…