<?php

$q = "SELECT * FROM `newcustomers` WHERE `account_location_id` = $location;";
if ($res = mysql_query($q, $link)) {
  while ($row = mysql_fetch_assoc($res)) {
         $crossentered = ($v = $row['cross_entered']) ? 'YES' : 'NO';
         $confirmed = ($v = $row['confirmed']) ? 'YES' : 'NO';
         $id = $row['id'];
  	$return .= '<tr><td><input type="checkbox" name="appts_to_delete[]" id="appt_' . $id . '" value="' . $id . '" /></td><td>' . $row['firstname'] . ' ' . $row['lastname'] . 
  	'</td><td>' . $row['email'] . '</td><td>' . $row['phone1'] . '</td><td>' .
  	 $row['date'] . ' ' . $row['time'] . '</td><td>' . $row['entered'] . '</td><td>' .
  	 $confirmed . '</td><td>' . $crossentered . '</td></tr>';
  } 
}
?>
<form name="managerecords" id="managerecords">
<input type="hidden" name="formAction" class="formAction" id="managerecords_formAction" value="" />
<input type="hidden" name="location" value="<?php echo $locID; ?>" />
<table>
<thead>
 <tr><th>Delete</th><th width="180">Name</th><th width="180">Email</th><th width="90">Phone</th><th width="180">Appointment</th><th width="180">Entered</th><th width="100">Confirmed?</th><th width="100">Cross-Entered?</th></tr>
</thead>
<tbody>
<?php echo $return; ?>
</tbody>
</table>
<input type="submit" id="deleteAppts" name="deleteAppts" value="Delete Selected" />
</form>