I am facing some difficulties in retrieving the values from the DB and displaying them in the textboxes. I am having a checkbox and two text fields which will iterate for 5 times. The value of the first checkbox is "S" and the title should be Spouse and the second textbox should be "D1" and the title will be Dependent 1. The iteration will be to the 5th the value which will be D4 and the title will be "Dependent 4". The problem is that when the Spouse entries are empty and they has no entries in the DB, the columns should be blank and the data should be retrieved in the second iteration from the DB for the other records (ex. D1). The values should in the second row where actually in this code, they will be placed at the beginning in the Spouse textboxes and the code will not skip the Spouse if it is blank and will retrieve the dependent records in it. My code is:
When a member views the form, he will find 5 checkboxes and a number of text fields to enter the information each for each member in his family like name, tel no., address, gender ..etc. The first checkbox by default should have the value "S" for Spouse and the other checkboxes will have values "D1" for "Dependent 1", "D2" for "Dependent 2"..etc. If he wants to enter the Spouse information, the member will tick the first checkbox and he will enter the fields and the same for the others.
Now, after entering the values, I am facing difficulties while retrieving the values if the member didn't enter the Spouse details and he had entered only for example dependent 1 information. My code will retrieve the dependent information in the Spouse fields which are incorrect.