title: How can I add a range of values to my database via SQL?
body: <p>I need to be able to send a range of Date values to my database. Here is my current working solution for adding a single date at a time:</p>
  
  <p>HTML:
  EDIT: I updated the HTML form to include the from/to fields instead of a single field.</p>
  
  <pre><code>&lt;form method="post" action="/PHP/update.php"&gt;
  &lt;table width="400" border="0" cellspacing="1" cellpadding="2"&gt;
  &lt;tr&gt;
  &lt;td width="100"&gt;From:&lt;/td&gt;
  &lt;td&gt;&lt;input name="fromdate" type="date" id="fromdate"&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td width="100"&gt;To:&lt;/td&gt;
  &lt;td&gt;&lt;input name="todate" type="date" id="todate"&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td width="100"&gt;Customer Name&lt;/td&gt;
  &lt;td&gt;&lt;input name="name" type="text" id="name"&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td width="100"&gt; &lt;/td&gt;
  &lt;td&gt; &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td width="100"&gt; &lt;/td&gt;
  &lt;td&gt;
  &lt;input name="update" type="submit" id="update" value="Update"&gt;
  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>PHP:</p>
  
  <pre><code>&lt;?php
  
  header( "refresh:2;url=/protected/update.html" );
  
  if(isset($_POST['update']))
  {
  $dbhost = 'localhost';
  $dbuser = 'USER';
  $dbpass = 'PASS';
  $conn = mysqli_connect($dbhost, $dbuser, $dbpass);
  if(! $conn )
  {
    die('Could not connect: ' . mysql_error());
  }
  
  $date = $_POST['date'];
  $name = $_POST['name'];
  
  $sql = "INSERT INTO calendar (date, customer)
  VALUES ('$date', '$name')";
  
  mysqli_select_db($conn, 'website_main');
  $retval = mysqli_query( $conn, $sql );
  if(! $retval )
  {
    die('Could not update data: ' . mysqli_error($conn));
  }
  echo "Updated data successfully,\n";
  echo "You will be re-directed shortly.\n";
  mysqli_close($conn);
  }
  else
  {
  ?&gt;
  &lt;?php
  }
  ?&gt;
  </code></pre>
  
  <p>This setup currently allows me to send a single date per click of the update button in the html form. </p>
  
  <p>However I would like to edit the form ( which I can do myself ) to have Dates: From [dd/mm/yyyy] to [dd/mm/yyy]. and then when I hit update, the PHP would be able to fill in the blanks e.g. if it were 01/01/2016 to 03/01/2016, the PHP would submit to the database 01/01/2016, 02/01/2016 and 03/01/2016.</p>
  
  <p>I am a total PHP noob, and had a lot of issues even trying to get the single date submission working. Any and all help would be appreciated.</p>
  
  <p>EDIT: I should have clarified this to begin with, my apologies. The Database is linked up to a calendar which updates and marks the dates red which are in the database. Because of this, each date MUST have an individual entry in the table. I CANNOT have startDate and endDate as 2 seperate columns in the same entry, due to the way that I have already setup the calendar. Is there any way around this without having to redo the code for my calendar?</p>