Drop down list in html using php and MySql
<p>I am trying to create a dropdown list that uses php to connect to a MySql database. But it's not working and I'm sure it's a simple change I need to make but because of the complicated fancy bootstrap form, I can't figure it out!</p>

<p>Here is the code I have:</p>

<pre><code>&lt;form method="post" action="bookings.php" class="popup-form"&gt;
                    &lt;fieldset&gt;
          &lt;input id="email" name="email" type="text" class="form-control form-white" placeholder="Email"&gt;
                    &lt;input id="firstname" name="firstname" type="text" class="form-control form-white" placeholder="Firstname"&gt;
                    &lt;input id="lastname" name="lastname" type="text" class="form-control form-white" placeholder="Surname"&gt;
          &lt;div class="dropdown"&gt;
                        &lt;button id="dLabel" for="retreatseleted" class="form-control form-white dropdown" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"&gt;
                            Select Retreat:
                        &lt;/button&gt;
                        &lt;ul for="retreatseleted" class="dropdown-menu animated fadeIn" role="menu" aria-labelledby="dLabel"&gt;
                            &lt;li id="retreatseleted" name="retreatseleted" value="Clifftop Cottage" class="animated lightSpeedIn"&gt;&lt;a href="#"&gt;Clifftop Cottage&lt;/a&gt;&lt;/li&gt;
                            &lt;li id="retreatseleted" name="retreatseleted" value="Cherry Trees" class="animated lightSpeedIn"&gt;&lt;a href="#"&gt;Cherry Trees&lt;/a&gt;&lt;/li&gt;
              &lt;li id="retreatseleted" name="retreatseleted" value="The Beach House" class="animated lightSpeedIn"&gt;&lt;a href="#"&gt;The Beach House&lt;/a&gt;&lt;/li&gt;
                        &lt;/ul&gt;
                    &lt;/div&gt;
          &lt;input id="fromdate" name="fromdate" type="date" class="form-control form-white" placeholder="From Date:"&gt;
          &lt;input id="todate" name="todate" type="date" class="form-control form-white" placeholder="To Date:"&gt;
                    &lt;div class="checkbox-holder text-left"&gt;
                        &lt;div class="checkbox"&gt;
                            &lt;input type="checkbox" value="None" id="squaredOne" name="check" /&gt;
                            &lt;label for="squaredOne"&gt;&lt;span&gt;I Agree to the &lt;strong&gt;Terms &amp;amp; Conditions&lt;/strong&gt;&lt;/span&gt;&lt;/label&gt;
                        &lt;/div&gt;
                    &lt;/div&gt;
                    &lt;button type="submit" value="Submit" class="btn btn-submit"&gt;Submit&lt;/button&gt;
                    &lt;/fieldset&gt;
                &lt;/form&gt;
</code></pre>

<p>And the php code I have is:</p>

<pre><code>ob_start();
session_start();

include("connectdb.php");

unset($_SESSION['error']);

  if (!empty($_POST)
   &amp;&amp; !empty($_POST['email'])
   &amp;&amp; !empty($_POST['firstname'])
   &amp;&amp; !empty($_POST['lastname'])
   &amp;&amp; !empty($_POST['retreatselected'])
   &amp;&amp; !empty($_POST['fromdate'])
   &amp;&amp; !empty($_POST['todate'])) {

    $email = $_POST['email'];
    $firstname = $_POST['firstname'];
    $lastname = $_POST['lastname'];
    $retreatselected = $_POST['retreatseleted'];
    $fromdate = $_POST['fromdate'];
    $todate = $_POST['todate'];

    $query = "SELECT COUNT(*) AS count FROM bookings WHERE fromdate = '".$fromdate."' and retreatselected = '".$retreatselected."'";
    $result = $db-&gt;query($query);
    $data = $result-&gt;fetch_assoc();


    if ($data['count'] &gt; 0) {

      $_SESSION['error'] = "Unfortunately this date has already been taken at $retreatselected.";
      header("location: index.php");


    } else {


      $query = "INSERT INTO bookings (email, firstname, lastname, retreatselected, fromdate, todate)
                VALUES ('".$email."','".$firstname."','".$lastname."','".$retreatselected."','".$fromdate."','".$todate."')";
      "&lt;/p&gt;";


      $result = $db-&gt;query($query);


      if ($result) {

        $_SESSION['thankyou'] = "Thank you for booking $retreatselected. You will receive a confirmation email shortly.";
            header("location: index.php");

      } else {
          echo "SQL Error: " . $db-&gt;error;
      }
    }
  }
?&gt;
</code></pre>

<p>It works perfectly when I take out the dropdown list and 'retreatselected' variable. I have a column in my database for retreatselected and I want the value the user chooses to appear in the database. </p>

<p>I'm pretty sure it's a simple id=/name=/value=  correction to make but I'm going mad trying every possibility!</p>

<p>Any help greatly appreciated :)</p>