How can i allow a user to select only 2checkboxes, if they choose more then 2an error message will appear saying you can only select 2, heres my code below where the checkboxes are used.

// Loop through data and display

while($a_row = mysql_fetch_assoc($result))
{
echo "<tr>".
	'<td style="color: black;"><input type="checkbox" name="bookings[]" value="'.$a_row['id'].'"></td>'.
	"<td style=\"color:Black\">".$a_row['Bookingdate']."</td>".
	"<td style=\"color:Black\">".$a_row['DayofWeek']."</td>".
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.