data not getting stored properly in database
<p>I am using this code for storing values in database ,but when i select multiple check-box only one eid value is getting stored in database ( which should be no of checkbox i have selected) and also rid value is stored as 0
where is the mistake?
this is php code</p>

<pre><code>&lt;?php //insert selected candidate in table                  
                    //echo "checkcandi".$_POST['check_candi']; 
if(isset($_POST['select_candidate']) &amp;&amp; logged_in())
{
  $checkcandi_sel = $_POST['check_candi'];
  if(empty($checkcandi_sel)) 
  {
    echo("You didn't select any Candidates.");
  } 
  else
  {
    $N = count($checkcandi_sel);

    echo("You selected $N Candidate(s): ");
    for($i=0; $i &lt; $N; $i++)
    {
      echo($checkcandi_sel[$i] . " ");
      $eid=$checkcandi_sel[$i];
       echo "candi id".$eid;
    }
  }

//$rid=$value[1];
if(logged_in())
    {
    $emplyrid=$_SESSION['uid'];
    echo "emplyrid".$emplyrid;
    }
//$rid=$_GET['rid'];
//var_dump($emplyrid);
$query = "INSERT INTO selected_candidate (
                            eid,rid
                        ) VALUES (
                             '{$eid}','{$emplyrid}'
                        )";
            $result = mysql_query($query, $connection);
            if ($result) {
                $message = "&lt;p style=\"color:green\"&gt;The Candidate selected and saved to your my seleted.&lt;/p&gt;";
            } else {
                $message = "Sorry job was not applied.";
                $message .= "&lt;br /&gt;" . mysql_error();
            }
}


?&gt;
</code></pre>

<p>this is code for check-box</p>

<pre><code>echo "&lt;td&gt;&lt;input id=\"select_candi{$i}\" onclick=\"javascript:func(this.id,{$_SESSION['uid']})\" type=\"checkbox\" name=\"check_candi[]\" value=\"{$data_set['eid']}\"/&gt;&lt;/td&gt;"; 
</code></pre>
