Hello,
I am trying to write a script that would display certain records from my table, and I would like each record to have a check box next to it. I want the user to be able to check as many boxes as they would like. When they hit submit only the records that have a check box next to it will be updated. What I am having trouble with is assigning names to the check boxes when im creating the form. I dont know ahead of time how many records I will be displaying so I dont know to give each check box a name.
To explain further: I connect to the database and retrieve all the records that I need. Then I created wile loop with mysql_fetch_array($result) which goes through each record that I retrieved. In this while loop im building a table inside a form. And for each record there is a new row in the table and the data displayed in the table is the data from the database record. Well in this while loop I would like to display a check box next to each record. But I dont understand how I can give it a name.
For example
<input type="checkbox" name="?????" value="paid_add">
How can I give each check box a unique name. So when I send this form to my next script I will be able to recall on it. I was thinking of giving it the same name as the id of the record but I was unsure of how to do that. Would I just need to say <input type="checkbox" name="$id" value="paid_add"> . If i did that wouldn't I receive some type of error when im trying to see if the box was checked or unchecked. For instance if I was dealing with the a record of $id=2 and <input type="checkbox" name="$id" value="paid_add">. So I called the checkbox 2. If i did the below I think I would get some type of error.
if (2 = "paid_add")
Any help would be greatly appreciated.
Thanks,
Ira