title: Using Checklists & Radios to input information into Databases
body: <p>So basically what I want to do is to grab the selected checklist element(s) and send their "name" to the database.  I would also like to do the same with the radios.  Here is the code:</p>
  
  <pre><code>&lt;?php       
          $user_files_directory = 'uploads/unused_images/'.$_SESSION['user_id'].'/';
  
          if (file_exists($user_files_directory)) {
  
          $dir_handle = @opendir($user_files_directory); 
  
          while ($file = readdir($dir_handle)) { 
  
          if($file == "." || $file == ".." || $file == "index.php" ) 
  
          continue; 
  
              echo "
              &lt;div id=\"image_container\"&gt;
                  &lt;div id=\"unused_images_selector\"&gt;
                      &lt;img src=\"uploads/thumbs/unused_images/".$_SESSION['user_id']."/$file\" alt=\"Test\"&gt;
                  &lt;/div&gt;
                  &lt;div id=\"checkbox\"&gt;
                          &lt;input type=\"checkbox\" name=\"$file\"&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
              "; 
          }
          // Close 
          closedir($dir_handle); 
  
          } else {
              echo    "&lt;p&gt;
                          You have not uploaded any images.
                      &lt;/p&gt;";
          }
      ?&gt;
  </code></pre>
  
  <p>A post for this exists:</p>
  
  <pre><code>$file = $_POST['file'];
  </code></pre>
  
  <p>And here is the rest:</p>
  
  <pre><code>function create_new_page($page_name, $album_name, $file, $file1, $file2) {
          $page_name = mysql_real_escape_string(htmlentities($page_name));
          mysql_query("INSERT INTO `pages` VALUES ('', '$album_name', '".$_SESSION['user_id']."', UNIX_TIMESTAMP(), '$page_name', '$file2', '$file3', '$file')");
          return mysql_insert_id();
      }
  </code></pre>
  
  <p>Everything but the radio/checklist works, any help is greatly appreciated, I know the code may not be the best but that's because I've not done much PHP, just want some working code though so not worried too much right now about issues here and there.</p>
  
  <p>EXTRA:  $file is the name of the images that are being placed in the page (it's a selection area for which images a user would like to use) and so I was hoping that, with using $file it would create the image name in the MYSQL database but it instead writes "array".  </p>