title: PHP Form Processing Multiple Checkboxes
body: <p>So i've got a table full of data. I have a page where i list all the contents of that able out through a while loop. Then the user can click a button on a record and it will generate an address label using the data it has and the generated label is done in a PDF. So that all works fine and dandy. However i was wondering is it possible to replace that button with an HTML Checkbox for each record to something like this</p>
  
  <pre><code>&lt;input type="checkbox" name="&lt;?php echo $recordTitle; ?&gt;" /&gt;
  &lt;input type="hidden" name="&lt;?php echo $recordID"; ?&gt;" /&gt;
  </code></pre>
  
  <p>So this would allow people to select multiple records and then click one button and it would take all of those records and generate as many labels as it needed too. If this is possible, how would i process all of that, because i'd need to somehow loop through all the records the user has selected. </p>
  
  <pre><code>&lt;?php
  $eventSearch = $_POST['eventSearch'];
  //Include Database connection
  include '../includes/dbConnect.php';
  
  foreach ($arr as &amp;$value) {
  $id = $value; 
  
  //Query Database for all customer info
  $sql = "SELECT * FROM customerInterest WHERE `id` = '$value'";
  $result = mysqli_query($dbLink, $sql);
  $row = mysqli_fetch_assoc($result);
  
  
  //require the document that creates the PDF
  require('PDF_Label.php');
  
  //Create a new PDF
  $pdf = new PDF_Label('L7163');
  $pdf-&gt;AddPage();
  
      //assign the customer information to a variable
      $sal =  $row["salutation"];
      $fn = $row["firstName"];
      $ln = $row["lastName"];
      $add1 = $row["contactAddress1"];
      $add2 = $row["contactAddress2"];
      $city = $row["contactAddressCity"];
      $state = $row["contactAddressState"];
      $post = $row["contactAddressPostcode"];
      $country = $row["contactAddressCountry"];
      if ($sal == "N/A") {
        $sal = "";
      }
      if ($fn == "N/A") {
        $fn = "";
      }
      if ($ln == "N/A") {
        $ln = "";
      }
      if ($add1 == "N/A") {
        $add1 = "";
      }
      if ($add2 == "N/A") {
        $add2 = "";
      }
      if ($city == "N/A") {
        $city = "";
      }
      if ($state == "N/A") {
        $state = "";
      }
      if ($post == "N/A") {
        $post = "";
      }
      if ($country == "N/A") {
        $country = " ";
      }
      $add1 = $add1." ".$add2;
  
      $post = str_replace(' ', '', $post);
      $post = strtoupper($post);
  
      $post = substr_replace($post, " ", 4, 0);
  
  
  
      // Standard format
  
      //create new page
  
  
          // Print labels
          $text = sprintf("%s\n%s\n%s\n%s %s",$sal." ".$fn." ".$ln, $add1, $city, $state, $post,$country);
          $pdf-&gt;Add_Label($text);
  
  
  }
   //Output all the info
   $pdf-&gt;Output();
  
  
  
  ?&gt;
  </code></pre>
  
  <p>So the above contains the code i have now tried. I have posted the data to the PDf generating page (that is where all the code is from) and i keep getting the error (see below) and i cannot figure out why :/ </p>
  
  <p>Fatal error: Uncaught Error: Call to a member function Output() on null in /homepages/38/d735513801/htdocs/future/pdfGen/labelEX.php:80 Stack trace: #0 {main} thrown in /homepages/38/d735513801/htdocs/future/pdfGen/labelEX.php on line 80</p>