title: Drop Down Menu Selection Not Being Sent To Database? Null value being inserted instead
body: <p>The HTML:</p>
  
  <pre><code>&lt;select name="Name" id=""&gt;
  &lt;?php
  while ($row = mysql_fetch_array($result)) {
  ?&gt;
  &lt;option value="&lt;?php $row['Name']; ?&gt;"&gt;&lt;?php echo $row['Name']; ?&gt;     &lt;/option&gt;
  &lt;?php
  } ?&gt;
  &lt;/select&gt; 
  </code></pre>
  
  <p>The PHP:</p>
  
  <pre><code>$Name=$_POST['Name'];
  
  if (isset ($_POST['submit']))
  {
  //$Name=$_POST['Name'];
  $ins=mysql_query("INSERT INTO Colleges (Name) VALUES ('$Name')") or die(mysql_error()) ;
  if($ins)
  {
      echo "&lt;br&gt;".$Name."inserted";
  }
  else
  {
      echo mysql_error();
  }
  }
  </code></pre>
  
  <p>The entire form code:</p>
  
  <pre><code>&lt;form method="post" action="template-insertdataprocessor.php" enctype="multipart/form-data" style="width: 80%; background: lightblue none repeat scroll 0% 0%; border: 2px solid darkcyan; margin-right: 55px; padding: 35px; margin-left: 55px;"&gt;
  
  &lt;p&gt; Upload your school logo in gif or jpeg format. The file name should be named after the school's name. If the same file name is uploaded twice it will be overwritten! &lt;/p&gt;
  
  
  
  &lt;p&gt; Logo: &lt;/p&gt;
  
  &lt;input type="hidden" name="size" value="350000"&gt;
  
  &lt;input type="file" name="schoollogo"&gt;&lt;br&gt;
  
  
  &lt;br&gt;&lt;table&gt;&lt;tr&gt;&lt;td style="width: 15%;"&gt;&lt;p&gt; Name of School:&lt;/td&gt;&lt;td style="width: 42.5%;"&gt;
  &lt;?php
  //$host = "localhost:3306";
  //$db_name="univers1_test";
  //$user = "";
  //$pass = "";
  
  //$conn = new mysqli($host, $user, $pass, $db_name) or die("DB Connection failed!!");
  mysql_connect("localhost:3306", "", "") or die(mysql_error()) ;
  mysql_select_db("univers1_test") or die(mysql_error()) ;
  $sql = "SELECT Name FROM Colleges2";
  $result = mysql_query($sql)  or die(mysqli_error()) ;
  
  //$stmt=$conn-&gt;query($sql);
  ?&gt;
  
  &lt;select name="Name" id=""&gt;
  &lt;?php
  while ($row = mysql_fetch_array($result)) {
  ?&gt;
  &lt;option value="&lt;?php echo $row['Name']; ?&gt;"&gt;&lt;?php echo $row['Name']; ?&gt;     &lt;/option&gt;
  &lt;?php
  } ?&gt;
  &lt;/select&gt; 
  &lt;/td&gt;&lt;/p&gt;&lt;/tr&gt;&lt;/table&gt;
   &lt;br&gt;&lt;br&gt;&lt;table&gt;&lt;tr&gt;&lt;td style="width: 15%;"&gt;&lt;p&gt;Brief description/history of college
   &lt;/td&gt;&lt;td style="width: 42.5%;"&gt;&lt;textarea rows="10" cols="35" name="Description"&gt; &lt;/textarea&gt; &lt;/td&gt;&lt;td style="width: 42.5%;"&gt;eg: "Built in 1880, UP was constructed by Engineer John Smith....It was recognized as an educational institution on.....It remains to be a leader in......"&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
  
   &lt;script type="text/javascript"&gt;
  
      CKEDITOR.replace( 'Description' );
  
    &lt;/script&gt;
  
  
  
  &lt;br&gt;&lt;br&gt;
  
  
  
  &lt;table&gt;&lt;tr&gt;&lt;td style="width: 15%;"&gt;&lt;p&gt;Term Type? (eg: Quarter, Semester) &lt;/td&gt;&lt;td style="width: 42.5%;"&gt;&lt;input style="width: 330px;" type="text" name="TermType"/&gt; &lt;/td&gt;&lt;td style="width: 42.5%;"&gt;eg: Quarter&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
  
  &lt;table&gt;&lt;tr&gt;&lt;td style="width: 15%;"&gt;&lt;p&gt;Entrance Exam Required? &lt;/td&gt;&lt;td style="width: 42.5%;"&gt;&lt;input style="width: 330px;" type="text" name="EntranceExam"/&gt; &lt;/td&gt;&lt;td style="width: 42.5%;"&gt;eg: No&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
  
  
  &lt;table&gt;&lt;tr&gt;&lt;td style="width: 15%;"&gt;&lt;p&gt;What is your college's website URL? (Please make sure your input is correct) &lt;/td&gt;&lt;td style="width: 42.5%;"&gt;&lt;input style="width: 330px;" type="text" name="collegewebsite"/&gt; &lt;/td&gt;&lt;td style="width: 42.5%;"&gt;eg: http://www.up.edu.ph&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
  
  
  
  &lt;table&gt;&lt;tr&gt;&lt;td style="width: 15%;"&gt;&lt;p&gt;What is the best way for a student or parent to contact the school? Any contact info?
  
  &lt;/td&gt;&lt;td style="width: 42.5%;"&gt;&lt;textarea rows="10" cols="35" name="ContactInfo"&gt; &lt;/textarea&gt; &lt;/td&gt;&lt;td style="width: 42.5%;"&gt;eg: Email and Phone&lt;br&gt;&lt;br&gt;Email: name@up.edu.ph&lt;br&gt;Phone: 123-4567&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
  
   &lt;script type="text/javascript"&gt;
  
      CKEDITOR.replace( 'ContactInfo' );
  
    &lt;/script&gt;
  
  &lt;br&gt;&lt;br&gt;&lt;table&gt;&lt;tr&gt;&lt;td style="width: 15%;"&gt;&lt;p&gt; Campus Locations (please make sure your input is correct): &lt;/td&gt;&lt;td style="width: 42.5%;"&gt;&lt;input style="width: 330px;" type="text" name="CampusLocations"/&gt; &lt;/td&gt;&lt;td style="width: 42.5%;"&gt;eg: Diliman, Baguio, Visayas, Los Banos....&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
  
  
  
  &lt;table&gt;&lt;tr&gt;&lt;td style="width: 15%;"&gt;&lt;p&gt; Certifications Offered:
  
  &lt;/td&gt;&lt;td style="width: 42.5%;"&gt;&lt;textarea rows="10" cols="35" name="Certifications"&gt; &lt;/textarea&gt; &lt;/td&gt;&lt;td style="width: 42.5%;"&gt;eg: Computer Repair&lt;br&gt;Health Tech&lt;br&gt;Electrician&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
  
   &lt;script type="text/javascript"&gt;
  
      CKEDITOR.replace( 'Certifications' );
  
    &lt;/script&gt;
  
  &lt;br&gt;&lt;br&gt;&lt;table&gt;&lt;tr&gt;&lt;td style="width: 15%;"&gt;&lt;p&gt; Diploma Courses Offered:
  
  &lt;/td&gt;&lt;td style="width: 42.5%;"&gt;&lt;textarea rows="10" cols="35" name="Diplomas"&gt; &lt;/textarea&gt; &lt;/td&gt;&lt;td style="width: 42.5%;"&gt;eg: Computer Tech&lt;br&gt;Advanced Health Tech&lt;br&gt;Advanced Electrician&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
  
   &lt;script type="text/javascript"&gt;
  
      CKEDITOR.replace( 'Diplomas' );
  
   &lt;/script&gt;
  
  &lt;br&gt;&lt;br&gt;&lt;table&gt;&lt;tr&gt;&lt;td style="width: 15%;"&gt;&lt;p&gt; Associate (2-Year) Degrees Offered:
  
  &lt;/td&gt;&lt;td style="width: 42.5%;"&gt;&lt;textarea rows="10" cols="35" name="AssociateDegrees"&gt; &lt;/textarea&gt; &lt;/td&gt;&lt;td style="width: 42.5%;"&gt;eg: Nursing&lt;br&gt;IT&lt;br&gt;Web development&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
  
   &lt;script type="text/javascript"&gt;
  
      CKEDITOR.replace( 'AssociateDegrees' );
  
    &lt;/script&gt;
  
  &lt;br&gt;&lt;br&gt;&lt;table&gt;&lt;tr&gt;&lt;td style="width: 15%;"&gt;&lt;p&gt; Bachelors (4-Year) Degrees Offered: 
  
  &lt;/td&gt;&lt;td style="width: 42.5%;"&gt;&lt;textarea rows="10" cols="35" name="BachelorsDegrees"&gt; &lt;/textarea&gt; &lt;/td&gt;&lt;td style="width: 42.5%;"&gt;eg: Nursing&lt;br&gt;Computer Engineering&lt;br&gt;Math&lt;br&gt;Marketing&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
  
   &lt;script type="text/javascript"&gt;
  
      CKEDITOR.replace( 'BachelorsDegrees' );
  
    &lt;/script&gt;
  
  &lt;br&gt;&lt;br&gt;&lt;table&gt;&lt;tr&gt;&lt;td style="width: 15%;"&gt;&lt;p&gt; Masters (5-6 Year) Degrees Offered:
  
  &lt;/td&gt;&lt;td style="width: 42.5%;"&gt;&lt;textarea rows="10" cols="35" name="MastersDegrees"&gt; &lt;/textarea&gt; &lt;/td&gt;&lt;td style="width: 42.5%;"&gt;eg: Business Administration&lt;br&gt;Nursing&lt;br&gt;Math&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
  
   &lt;script type="text/javascript"&gt;
  
      CKEDITOR.replace( 'MastersDegrees' );
  
    &lt;/script&gt;
  
  &lt;br&gt;&lt;br&gt;&lt;table&gt;&lt;tr&gt;&lt;td style="width: 15%;"&gt;&lt;p&gt;Doctorate Degrees Offered
  
  &lt;/td&gt;&lt;td style="width: 42.5%;"&gt;&lt;textarea rows="10" cols="35" name="DoctorateDegrees"&gt; &lt;/textarea&gt; &lt;/td&gt;&lt;td style="width: 42.5%;"&gt;eg: Theology&lt;br&gt;Math&lt;br&gt;Philosophy&lt;br&gt;Medicine&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
  
   &lt;script type="text/javascript"&gt;
  
      CKEDITOR.replace( 'DoctorateDegrees' );
  
    &lt;/script&gt;
  
  &lt;br&gt;&lt;br&gt;&lt;table&gt;&lt;tr&gt;&lt;td style="width: 15%;"&gt;&lt;p&gt;Does your college offer any special degree programs?
  
  &lt;/td&gt;&lt;td style="width: 42.5%;"&gt;&lt;textarea rows="10" cols="35" name="SpecialDegreePrograms"&gt; &lt;/textarea&gt; &lt;/td&gt;&lt;td style="width: 42.5%;"&gt;eg: ETEEAP&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
  
   &lt;script type="text/javascript"&gt;
  
      CKEDITOR.replace( 'SpecialDegreePrograms' );
  
    &lt;/script&gt;
  
  &lt;br&gt;&lt;br&gt;&lt;table&gt;&lt;tr&gt;&lt;td style="width: 15%;"&gt;&lt;p&gt; Accreditations:
  
  &lt;/td&gt;&lt;td style="width: 42.5%;"&gt;&lt;textarea rows="10" cols="35" name="Accreditation"&gt; &lt;/textarea&gt; &lt;/td&gt;&lt;td style="width: 42.5%;"&gt;eg: ABET&lt;br&gt;PAASCU&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
  
      &lt;script type="text/javascript"&gt;
  
      CKEDITOR.replace( 'Accreditation' );
  
    &lt;/script&gt;
  
  &lt;br&gt;
  
  &lt;input TYPE="submit" name="upload" title="Add data to the Database" value="Add College"/&gt;
  
  &lt;/form&gt;
  </code></pre>
  
  <p>The entire PHP code:</p>
  
  <pre><code>&lt;?php
  
  ini_set("display_errors",1); error_reporting(E_ALL);
  
  //This is the directory where images will be saved
  
  $targetscreenshots = "images/"; 
  $targetscreenshots = $targetscreenshots . basename( $_FILES['files[]']['name']);
  
  $target = "images/logo/";
  $target = $target . basename( $_FILES['schoollogo']['name']);
  
  $targetotherimage = "images/otherimage/";
  $targetotherimage = $targetotherimage . basename( $_FILES['otherimage']['name']);
  
  
  
  
  //This gets all the other information from the form
  
  $schoollogo=($_FILES['schoollogo']['name']);
  $otherimage=($_FILES['otherimage']['name']);
  
  $Name=$_POST['Name'];
  
  $Motto=$_POST['Motto'];
  
  $Description=$_POST['Description'];
  
  $Type=$_POST['Type'];
  
  $ReligiousAffiliation=$_POST['ReligiousAffiliation'];
  
  $OtherPartnerships=$_POST['OtherPartnerships'];
  
  $GenderAdmission=$_POST['GenderAdmission'];
  
  $TermType=$_POST['TermType'];
  
  $EntranceExam=$_POST['EntranceExam'];
  
  $EntranceExamDate=$_POST['EntranceExamDate'];
  
  $TotalEnrolled=$_POST['TotalEnrolled'];
  
  $collegewebsite=$_POST['collegewebsite'];
  
  $ContactInfo=$_POST['ContactInfo'];
  
  $CampusLocations=$_POST['CampusLocations'];
  
  $Certifications=$_POST['Certifications'];
  
  $Diplomas=$_POST['Diplomas'];
  
  $AssociateDegrees=$_POST['AssociateDegrees'];
  
  $BachelorsDegrees=$_POST['BachelorsDegrees'];
  
  $MastersDegrees=$_POST['MastersDegrees'];
  
  $DoctorateDegrees=$_POST['DoctorateDegrees'];
  
  $SpecialDegreePrograms=$_POST['SpecialDegreePrograms'];
  
  $Accreditation=$_POST['Accreditation'];
  
  $CostofTuitionLocal=$_POST['CostofTuitionLocal'];
  
  $CostofTuitionForeign=$_POST['CostofTuitionForeign'];
  
  $Housing=$_POST['Housing'];
  
  $AcceptanceRate=$_POST['AcceptanceRate'];
  
  $CoE=$_POST['CoE'];
  
  $CoD=$_POST['CoD'];
  
  //$files=($_FILES['files[]']['name']);
  
  
  
  // Connects to your Database
  
  mysql_connect("localhost:3306", "", "") or die(mysql_error()) ;
  
  mysql_select_db("univers1_test") or die(mysql_error()) ;
  
  
  
  //Writes the information to the database
  
  $text = trim($_POST['BachelorsDegrees']);
  $textAr = explode("\n", $text);
  $textAr = array_filter($textAr, 'trim'); // remove any extra \r characters left behind
  
  foreach ($textAr as $BachelorsDegrees) {
  mysql_query("INSERT INTO Colleges (BachelorsDegrees) VALUES ('$BachelorsDegrees')") or die(mysql_error()) ;
  
  } 
  if (isset ($_POST['submit']))
  {
  //$Name=$_POST['Name'];
  $ins=mysql_query("INSERT INTO Colleges (Name) VALUES ('$Name')") or die(mysql_error()) ;
  if($ins)
  {
      echo "&lt;br&gt;".$Name."inserted";
  }
      else
  {
      echo mysql_error();
      }
  }
  
  
  mysql_query("INSERT INTO Colleges (schoollogo,Motto,Description,Type,ReligiousAffiliation,OtherPartnerships,GenderAdmission,TermType,EntranceExam,EntranceExamDate,TotalEnrolled,collegewebsite,ContactInfo,CampusLocations,Certifications,Diplomas,AssociateDegrees,MastersDegrees,DoctorateDegrees,SpecialDegreePrograms,Accreditation,CostofTuitionLocal,CostofTuitionForeign,Housing,AcceptanceRate,CoE,CoD) VALUES ('$schoollogo', '$Motto', '$Description', '$Type', '$ReligiousAffiliation', '$OtherPartnerships', '$GenderAdmission', '$TermType', '$EntranceExam', '$EntranceExamDate', '$TotalEnrolled', '$collegewebsite', '$ContactInfo', '$CampusLocations', '$Certifications', '$Diplomas', '$AssociateDegrees', '$MastersDegrees', '$DoctorateDegrees','$SpecialDegreePrograms','$Accreditation','$CostofTuitionLocal','$CostofTuitionForeign','$Housing','$AcceptanceRate','$CoE','$CoD')") or die(mysql_error()) ;
  
  //Writes the logo to the server
  if(move_uploaded_file($_FILES['schoollogo']['tmp_name'], $target))
  
  //&amp;&amp; (move_uploaded_file($_FILES['otherimage']['tmp_name'], $targetotherimage)) //optional second input single-upload
   {
  
  //Tells you if its all ok
  echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory";
  }
  else {
  
  //Gives and error if its not
  echo "Sorry, there was a problem uploading your file.";
  }
  
  //Writes the screenshots to the server
  
  //$imageArr = array();
  
  //foreach ($_FILES['files']['error'] as $key =&gt; $error)
  //    {
  //       if($error == UPLOAD_ERR_OK) {
  //      $tmp_name = $_FILES["files"]["tmp_name"][$key];
  //      $name = $_FILES["image"]["name"][$key];
  //      move_uploaded_file($tmp_name, $targetscreenshots/$name");
  //      array_push($imageArr,$name);
  //  }
  //    }
  
  //$sql=mysql_query("INSERT into Colleges SET files='".json_encode($imageArr)."'"); // inserting data if file is moved
  
  //if(isset($_POST) and $_SERVER['REQUEST_METHOD'] == "POST"){
  
  $valid_formats = array("jpg", "png", "gif", "zip", "bmp");
  $max_file_size = 1024*100; //100 kb
  $count = 0;
  $upath="../images/";
  
  // Loop $_FILES to execute all files
  foreach ($_FILES['files']['name'] as $key =&gt; $file) {     
      if ($_FILES['files']['error'][$key] == 4) {
          continue;  //Skip file if any error found
      }          
      if ($_FILES['files']['error'][$key] == 0) {            
          if ($_FILES['files']['size'][$key] &gt; $max_file_size) {
              $message[] = "$file is too large!.";
              continue;  //Skip large files
          }
          elseif( ! in_array(pathinfo($file, PATHINFO_EXTENSION), $valid_formats) ){
              $message[] = "$file is not a valid format";
              continue;  //Skip invalid file formats
          }
          else{  //No error found! Move uploaded files 
          $target = $upath.$file;
              $path=substr($target,3);
              if(move_uploaded_file($_FILES["files"]["tmp_name"][$key], $targetscreenshots.$file))
  
          mysql_query("INSERT into Colleges (`files`) VALUES ('$path')");      //inserting data if file is moved
              $count++;  //Number of successfully uploaded file
  
          echo "yay";
          }
      }
  }
  //}
  //}
  
  ?&gt;
  </code></pre>
  
  <p>Take note:</p>
  
  <ul>
  <li>I've tried mysqli to no avail...not sure why but it never seems to work for me.</li>
  <li>I've read some duplicated posts.....still not sure what is wrong.</li>
  </ul>
  
  <p>No error or success message.  The Name column just has a NULL value inserted into it. </p>