title: textarea text not inserting to php database mysql
body: <p>hi guys pls help me whit this option(textarea) not submiting to database php mysql here are my codes tnx. it has a Javascript function. i need to send the option(textarea) to the database php/mysql. text not inserting. or it can be numbers of how many food they selected.</p>
  
  <p><strong>select.html</strong></p>
  
  <pre><code>&lt;html lang="en"&gt;
  &lt;head&gt;
  &lt;title&gt;Catering Service&lt;/title&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"&gt;&lt;/script&gt; 
  &lt;script src="js/js.1.js" type="text/javascript"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
       &lt;form action="submit.php" method="post"&gt;
           &lt;select multiple="multiple" class="options" id="textarea"&gt;
           &lt;option value="foodA"&gt;foodA&lt;/option&gt;
           &lt;option value="foodB"&gt;foodB&lt;/option&gt;
           &lt;option value="foodC"&gt;foodC&lt;/option&gt;
           &lt;option value="foodD"&gt;foodD&lt;/option&gt;
        &lt;option value="foodE"&gt;foodE&lt;/option&gt;
       &lt;/select&gt;
  
  
           &lt;button type="button" id="copy"&gt;Copy&lt;/button&gt;
           &lt;button type="button" id="remove"&gt;Remove&lt;/button&gt;
  
            &lt;!-- note how multiple select name must be set --&gt;
            &lt;select id="textarea2" multiple class="remove" name="food[]"&gt; 
            &lt;/select&gt;
  
            &lt;input type="submit" name="submit" /&gt;
            &lt;/form&gt;
            &lt;/body&gt;
             &lt;/html&gt;
  </code></pre>
  
  <p><strong>submit.php</strong></p>
  
  <pre><code>&lt;?php
    include 'connection.php';
  
  foreach ($_POST['food'] as $food){
       $food == "foodA" ? $foodA = $food : $foodA = '';
       $food == "foodB" ? $foodB = $food : $foodB = '';
       $food == "foodC" ? $foodC = $food : $foodC = '';
       $food == "foodD" ? $foodD = $food : $foodD = '';
       $food == "foodE" ? $foodE = $food : $foodE = '';
  
  
  if(!$_POST['submit']) {
      echo "please fill out the form";
      header('Location: select.html');
  }
  else {
      $sql = "INSERT INTO remove(foodA, foodB, foodC, foodD, foodE) VALUES (?,?,?,?,?);";
      $stmt = mysqli_prepare($conn, $sql);
      mysqli_stmt_bind_param($stmt,"sssss",$foodA,$foodB,$foodC,$foodD,$foodE);
      mysqli_stmt_execute($stmt);
      echo "User has been added!";
      header('Location: select.html');
  }
  </code></pre>
  
  <p><strong>connection.php</strong></p>
  
  <pre><code>&lt;?php
  $dbhost = "localhost";
  $dbuser = "root";
  $dbpass = "";
  $db = "copy";
  $conn = mysqli_connect($dbhost,$dbuser,$dbpass,$db);
   ?&gt;
  </code></pre>
  
  <p><strong>js.1.js (JavaScript)</strong></p>
  
  <pre><code>   $(function(){ 
     $("#copy").on("click", function(){ 
     $(".options option:selected").each(function({
     $("#textarea2").append('&lt;option selected&gt;'+$(this).text()+'&lt;/option&gt;');
     $('option:selected', "#textarea").remove(); 
    });
  }); 
      $("#remove").on("click", function(){ 
      $(".remove option:selected").each(function(){
      $("#textarea").append('&lt;option&gt;'+$(this).text()+'&lt;/option&gt;');
      $('option:selected', "#textarea2").remove(); 
     }); 
   }); 
  </code></pre>
  
  <p>}); </p>