# Checkboxes with dynamic names/values

**URL:** <https://forum.kirupa.com/t/checkboxes-with-dynamic-names-values/241908>\
**Category:** Uncategorized\
**Created:** [October 19, 2007, 10:00am UTC](https://forum.kirupa.com/t/checkboxes-with-dynamic-names-values/241908 "2007-10-19T10:00:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Patch](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/patch/32/1095_2.png) [@Patch](https://forum.kirupa.com/u/Patch)\
**Post date:** [October 19, 2007, 10:00am UTC](https://forum.kirupa.com/t/checkboxes-with-dynamic-names-values/241908/1 "2007-10-19T10:00:37Z")

</div>

Hi guys I need a little help again.

I have a form that cotains a checkbox with a dynamic name or value ( I’m not sure whats best to use a name or value?)

```php

<?
			$cl_query = "SELECT * FROM email_cats ORDER BY cat_id ASC";
			$cl_result = mysql_query($cl_query);
			
			while($c_list = mysql_fetch_assoc($cl_result)) {
			//echo "<label>" . stripslashes(htmlspecialchars($c_list['cat'])) ."</label><input type=\"checkbox\" value=\"" . $c_list['cat_id'] . "\" name=\"".$c_list['cat_id']."\"/><br />";
			echo "<label>" . stripslashes(htmlspecialchars($c_list['cat'])) ."</label><input type=\"checkbox\" value=\"" . $c_list['cat_id'] . "\" name=\"group\"/><br />";

			}
		
			?>

```

As you can see I have the checkbox in a while loop (not sure if thats the best way, but it sort of works).

I just need to create an if statement or something so that I know if the checkbox is ticked/checked. I’ve been trying to do it for a couple of weeks without any luck. Would the if statement have to be in a loop as well or something? I’m not sure. Any help or advice would be really helpful!

Thanks
