title: how to set an associative array as html input value?
body: <p>Ive new in php and Im learning now how to retrive data from sql.
  Ive faced some issue that I couldnt find any answer for it over the web.</p>
  
  <p>I would like to make an html form with many check boxes (as many as my data base supplies) and to every check box i would like to assign an associative array that contains all of the row data from the db.
  for example if I have in my db columns names 'first name','last name' and 'age' the check box value will be ['first name'=>'xx', 'last name'=>'yy', age'14'];</p>
  
  <p>so far Ive only manage to pass it as as string like this:</p>
  
  <pre><code>value="&lt;?php echo implode(array('key'=&gt;$row['first name'], 'name'=&gt;$row['last name'],'type'=&gt;$row['age']));?&gt;"/&gt;
  </code></pre>
  
  <p>but when I pass it with post method I get regular String that I cant format to an array again.. this is my form code :</p>
  
  <pre><code>function deleteRow(){
  global $conn;
  if(!$conn){
      die("connection failed: ".mysqli_connect_error());
  }else{
      $query = "SELECT * FROM salary.collage ";
      $result=mysqli_query($conn, $query);
      echo "&lt;table border='1'&gt;";
      echo "&lt;form method='post' id='form_delete_rows' action='test.php'";
      while($row = mysqli_fetch_assoc($result)) {
  
          ?&gt;
              &lt;tr&gt;      
                  &lt;td&gt;&lt;input type="checkbox" name="key[]" value="&lt;?php echo implode(array('key'=&gt;$row['key'], 'name'=&gt;$row['name'],'type'=&gt;$row['type']));?&gt;"/&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;?php echo $row['key']?&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;?php echo $row['name']?&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;?php echo $row['type']?&gt;&lt;/td&gt;
              &lt;/tr&gt;
  
  
          &lt;?php
         }
       echo"&lt;input type='submit' name='deleteRows' value='delete selected rows'/&gt;";
       echo "&lt;/form&gt;";
       echo "&lt;/table&gt;";
  </code></pre>
  
  <p>and this is the function that handles the retrieved data:</p>
  
  <pre><code>   if(!empty($_POST["deleteRows"])){
          if(isset($_POST["key"])){
  
       var_dump($_POST["key"]);
  
            echo "are you sure you want to delete these records?&lt;br/&gt;";
            echo "&lt;pre&gt;&lt;table border='1'&gt;";
  
              foreach ($_POST['key'] as $select=&gt;$value) {
                  echo "&lt;tr&gt;";
                  echo "&lt;td&gt;{$select}&lt;/td&gt;";
                  echo "&lt;td&gt;{$value}&lt;/td&gt;";
                  echo "&lt;/tr&gt;";
              }
          }echo "&lt;/table&gt;&lt;/pre&gt;";
      }
  </code></pre>