Unable to generate a string
<p>I have a group of 7 checkboxes as name="restriction[]" and value that I have assigned is Pos1 to POS7. Now I wish to generate string according to selected chechkboxes that is If 1st,5th, 7th boxes are selected it gives me sting as 1000101
if only first is selected it generate 1000000</p>

<p>My code is </p>

<pre><code>if(isset($_POST["submit"])){
for ($i=1;$i&lt;count(restriction);$i++)
{   
if($restriction[i].checked)
{
    $val=$val+"1";
} else {
    $val=$val+"0";
}
}
echo $val;
}
</code></pre>

<p>but its gives me error where I have used if condition.</p>
