write form data to xls file
<p>I just wanted to know if this is possible and if so, can i get a starting point. </p>

<p>Right now, I am looking to create an html form, and POST the data to an excel spreadsheet. I will be using PHP to POST the form data. The form will be set up as 2 tables. The 2 tables will be labeled as a Shortage table, and the other as an Overage table. I have a drop down menu with the names of people. what i am trying to accomplish is have the data write to an excel spreadsheet and separate the values from the shortage table and the values from the overage table. For example, if the shortage table contains 4 entries, and the overage contains 2 entries, in the excel spreadsheet i would like for cell A1 to say overage, row 2 will contain the column headers (i.e. date, description, size, etc...), and then have row 8 start off Overage, row 9 will have the headers, and row 10 on will contain the values inputted. Granted this will not always be the case, just an example. </p>

<p>My major goal is to have it set up this way. Each person will have a worksheet created specifically for them. This form will be used on a daily basis, so the filename will have the date on there. So each day the form will opened, and once the submit button has been pressed, i would like to have a worksheet created for that person containing the data from the 2 tables. For example, Bill Smith is the first entry today. the information from the 2 tables has been entered in, I select the submit button. Within the directory, there is an excel file labeled as, data03/29/16.xls. Within that excel workbook, a worksheet will contain the label/tab Bill Smith. </p>

<p>Is this at all possible, or would it be easier and efficient to write the form data to a CSV file?</p>

<p>Edit:</p>

<pre><code>&lt;!DOCTYPE HTML&gt;

&lt;html&gt;

&lt;head&gt;
&lt;title&gt; Drive Check In &lt;/title&gt;

&lt;script type = "text/javascript"&gt;

function reset()
{
  var driver = document.getElementById("drivers");
  var date = docuemt.getElementById("dates");
  var custnum = document.getElementById("customernum");
  var invnum = document.getElementById("invoicenum");
  var proddesc = document.getElementById("proddes");
  var sz = document.getElementById("size");
  var cs = document.getElementById("cs");
  var btls = document.getElementById("btls");
  var chkint = document.getElementById("chkitls");

  driver.value.reset();
  date.value.reset();
  custnum.value.reset();

}

&lt;/script&gt;

&lt;/head&gt;

&lt;body&gt;

&lt;form action = '' method = "post"&gt;
&lt;table id = "shortages" &gt;
&lt;h1&gt; Shortages &lt;/h1&gt;
&lt;thead&gt;
&lt;tr&gt;
  &lt;th&gt; Driver &lt;/th&gt;
  &lt;th&gt; Date &lt;/th&gt; 
  &lt;th&gt; Customer# &lt;/th&gt;
  &lt;th&gt; Invoice# &lt;/th&gt;
  &lt;th&gt; Product Description &lt;/th&gt;
  &lt;th&gt; Size &lt;/th&gt;
  &lt;th&gt; CS &lt;/th&gt;
  &lt;th&gt; Btls &lt;/th&gt;
  &lt;th&gt; CHK Itls &lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tr&gt;
  &lt;td&gt;
  &lt;select id = "drivers" name = 'drivers'&gt;
    &lt;option value = " "&gt; &lt;/option&gt;
    &lt;option value = "Driver1"&gt; Driver1 &lt;/option&gt;
    &lt;option value = "Driver2"&gt; Driver2 &lt;/option&gt;
    &lt;option value = "Driver3"&gt; Driver3 &lt;/option&gt;

  &lt;/select&gt;&lt;/td&gt;

  &lt;td&gt; &lt;input type = "text" id = "dates"size = "10" name = "dates"&gt; &lt;/input&gt; &lt;/td&gt;
  &lt;td&gt; &lt;input type = "number" min = "1" max = "99999999" id = "customernum" name = "customernum"&gt; &lt;/input&gt; &lt;/td&gt;
  &lt;td&gt; &lt;input type = "number" min = "1" max = "99999999" id = "invoicenum" name = "invoicenum"&gt; &lt;/input&gt; &lt;/td&gt;
  &lt;td&gt; &lt;input type = "text" id = "proddes" name = "proddes"&gt; &lt;/input&gt; &lt;/td&gt;
  &lt;td&gt; &lt;input type = "number" id = "size" name = "size"&gt; &lt;/input&gt; &lt;/td&gt;
  &lt;td&gt; &lt;input type = "number" id = "cs" name = "cs"&gt; &lt;/input&gt; &lt;/td&gt;
  &lt;td&gt; &lt;input type = "number" id = "btls" name = "btls"&gt; &lt;/input&gt; &lt;/td&gt;
  &lt;td&gt; &lt;input type = "text" id = "chkitls" name = "chkitls"&gt; &lt;/input&gt; &lt;/td&gt;
&lt;/tr&gt;

&lt;/table&gt;

&lt;input type = "submit" value = "submit" name = "mydrivers&gt;

&lt;?php

function myfputcsv($handle, $array, $delimiter = ',', $enclosure = '"', $eol = "\n") {
    $return = fputcsv($handle, $array, $delimiter, $enclosure);
    if($return !== FALSE &amp;&amp; "\n" != $eol &amp;&amp; 0 === fseek($handle, -1, SEEK_CUR)) {
        fwrite($handle, $eol);
    }
    return $return;
}

if(isset($_POST['mydrivers']))  {  
$header=array();
$data=array();
 foreach (array_slice($_POST,0,count($_POST)-1) as $key =&gt; $value) {    
     //$header[]=$key;
     $data[]=$value;
 }  
$fp = fopen('driver.csv', 'a+');
    //fputcsv($fp, $header);
    myfputcsv($fp, $data);
fclose($fp);
}

?&gt;
&lt;/form&gt;

&lt;/html&gt;
</code></pre>

<p>This is the php file that I have so far. I was using this without implementing your suggestions, but I will implement them.</p>

<p>This is my main output goal. After the cvs file is opened and formatted, this is the main goal. </p>

<p><a href="http://i.stack.imgur.com/XbntT.png" rel="nofollow">Main output goal</a></p>

<p>Edit 2:
After implementing your code, this is the output I am receiving. <a href="http://i.stack.imgur.com/UGmuO.png" rel="nofollow">Output screen</a></p>