i try to solve a problem.

and this is my code.
<?php
require 'connectDB.php';
print<<<_A_
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
_A_;
$mysql = new mysql();
$mysql->connect();
$dbResult = mysql_query("select * from profiles");
echo "<form action='#' method='post'>";
$dbResult = mysql_query("select * from profiles");
while ($info = mysql_fetch_array($dbResult)) {
if ($info['isPremium'] == 0)
echo "<input type=checkbox name='check2[]' id='check2' value=".$info['id'].">";
else
echo "<input type=checkbox name='check1[]' id='check1' value=".$info['id']." checked>";
echo $info['profileName'] . "<br />";
}
echo "<p><input type='submit' name='btnPremium' /></p>";
echo "</form>";
If user click to a checkbox i send db a query in order to make it 1.However, when a user uncheck a checkbox i take this error: Undefined index: check2 in C:\xampp\htdocs\googleAnalytics\GAPI\choosePremium.php on line 43 I try to keep unchecks in arrPremium2 :S
if (isset($_POST['btnPremium'])) {
$arrPremium = $_POST['check1'];
foreach($arrPremium as $result)
{
mysql_query("UPDATE profiles set isPremium=1 where id=".$result."");
}
$arrPremium2 = $_POST['check2'];
print_r($arrPremium2);
}
?>