title: access level on user and page wise
body: <p>i have created a script for access level. where i give access on user basis for each page. </p>
  
  <p>i have a table <code>pages</code> with links and page name and i have table <code>access</code> to store page ids with user id who has the access to which page</p>
  
  <p>here is the structure of <code>pages</code></p>
  
  <pre><code>`page_id  | code  | page  | href
   1        | ld    | New   | sl/lead.php
   2        | ld    | View  | sl/lead_view.php 
   3        | ld    | Edit  | sl/lead_edit.php
   4        | ld    | Delete| sl/lead_delete.php
   5        | cst   | New   | sl/customer.php`
  </code></pre>
  
  <p><code>access</code> table</p>
  
  <pre><code>`aid | page_id | user_id
    1  | 1       | 1
    2  | 2       | 1
    3  | 3       | 1
    4  | 4       | 1
    5  | 5       | 1`
  </code></pre>
  
  <p>Giving access like this</p>
  
  <pre><code>&lt;ul id="demo2" class="mnav"&gt;
      &lt;li&gt;&lt;a href="#"&gt;Sales&lt;/a&gt;
      &lt;ul&gt;
      &lt;li&gt;&lt;a href="#"&gt;Lead&lt;/a&gt;
                  &lt;ul&gt;&lt;table align="center" width="900px;"&gt;
                  &lt;?php $s1 = mysqli_query($con, "SELECT * FROM pages WHERE code='ld'") or die(mysqli_error($con));
                  while($s2 = mysqli_fetch_array($s1)) { ?&gt;
                  &lt;tr&gt;&lt;td&gt;&lt;li&gt;&lt;?php echo $s2['page']; ?&gt;  &lt;/td&gt;&lt;td&gt;&lt;input type="checkbox" name="sn[]" value="&lt;?php echo $s2['page_id']; ?&gt;" /&gt; &lt;/li&gt;&lt;/td&gt;&lt;/tr&gt;
                  &lt;?php } ?&gt;
                  &lt;/table&gt;  
                  &lt;/ul&gt;
              &lt;/li&gt;   
  
              &lt;li&gt;&lt;a href="#"&gt;Customer&lt;/a&gt;
                  &lt;ul&gt;&lt;table align="center" width="900px;"&gt;
                  &lt;?php $s1 = mysqli_query($con, "SELECT * FROM pages WHERE code='cst'") or die(mysqli_error($con));
                  while($s2 = mysqli_fetch_array($s1)) { ?&gt;
                  &lt;tr&gt;&lt;td&gt;&lt;li&gt;&lt;?php echo $s2['page']; ?&gt;  &lt;/td&gt;&lt;td&gt;&lt;input type="checkbox" name="sn[]" value="&lt;?php echo $s2['page_id']; ?&gt;" /&gt; &lt;/li&gt;&lt;/td&gt;&lt;/tr&gt;
                  &lt;?php } ?&gt;
                  &lt;/table&gt;  
                  &lt;/ul&gt;
              &lt;/li&gt;
  
  
  
  &lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>I am saving it like this</p>
  
  <pre><code> if(isset($_POST['submit']))
      {
          $user = $_POST['user'];
  
      foreach($_POST['sn'] as $sn)
      {
       $sql = "insert into access (page_id, user_id, active) values (".$sn.", ".$user.", 1)";
      $query = mysqli_query($con, $sql) or die (mysqli_error($con));
      }
      }
  </code></pre>
  
  <p>User ID i am getting from a dropdown. Code works fine. But instead of <code>Delete</code> option i want to make it as <code>All</code>. When i check <code>All</code> checkbox, it should check all the value (New, View, Edit, Delete) from that code. I am not geting how to do it</p>