如何创建用于连接数据库的索引文件

I am creating a form using HTML, PHP and MySQL. I need help trying to link all the 3 together and send the data to the database.

Have researched quite a bit online and I see we have to create some kind of index file but because I am a beginner at all of this I am finding it hard to understand how to proceed. I have created the form with HTML, PHP and Excel (as the database) but I need to shift that to MySQL.

<?php

$error = '';
$RequestorName = '';
$SESAID = '';
$Q2C = '';
$Line = '';
$ExpectedDate = '';
$ReasonList = '';
$Description = '';
$checkbox = '';

function clean_text($string)
{
 $string = trim($string);
 $string = stripslashes($string);
 $string = htmlspecialchars($string);
 return $string;
}

if(isset($_POST["submit"]))
{
 if(empty($_POST["RequestorName"]))
 {
  $error .= '<p><label class="text-danger">Please Enter Requestor Name</label> 
  </p>';
 }
 else
 {
  $RequestorName = clean_text($_POST["RequestorName"]);
 }

 if(empty($_POST["SESAID"]))
 {
  $error .= '<p><label class="text-danger">Please Enter SESAID</label></p>';
 }
 else
 {
  $SESAID = clean_text($_POST["SESAID"]);
 }

 if(empty($_POST["Q2C"]))
 {
  $error .= '<p><label class="text-danger">Please Enter Q2C Number</label> 
  </p>';
 }
 else
 {
  $Q2C = clean_text($_POST["Q2C"]);
 }

 if(empty($_POST["Line"]))
 {
  $error .= '<p><label class="text-danger">Please Enter Line Number</label> 
  </p>';
 }
 else
 {
  $Line = clean_text($_POST["Line"]);
 }

 if(empty($_POST["ExpectedDate"]))
 {
  $error .= '<p><label class="text-danger">Expected Date is required</label> 
  </p>';
 }
 else
 {
  $ExpectedDate = clean_text($_POST["ExpectedDate"]);
 }

 if(!isset($_POST["ReasonList"]))
 {
  $error .= '<p><label class="text-danger">Please select a reason</label> 
  </p>';
 }
 else
 {
  $ReasonList = clean_text($_POST["ReasonList"]);
 }

 if(empty($_POST["Description"]))
 {
  $error .= '<p><label class="text-danger">Description is required</label> 
  </p>';
 }
 else
 {
  $Description = clean_text($_POST["Description"]);
 }

 if(!isset($_POST["checkbox"]))
 {
  $error .= '<p><label class="text-danger">Please upload all the files</label> 
  </p>';
 }

 if($error == '')
 {
  $file_open = fopen("Revision_Tracker.csv", "a");
  $no_rows = count(file("Revision_tracker.csv"));
  if($no_rows > 1)
  {
   $no_rows = ($no_rows - 1) + 1;
  }
  $form_data = array(
   'sr_no'  => $no_rows,
   'RequestorName' => $RequestorName,
   'SESAID' => $SESAID,
   'Q2C'  => $Q2C,
   'Line'  => $Line,
   'ExpectedDate' => $ExpectedDate,
   'ReasonList'  => $ReasonList,  
   'Description' => $Description
  );
  fputcsv($file_open, $form_data);
  $error = '<label class="text-success">Thank you!</label>';
  $RequestorName = '';
  $SESAID = '';
  $Q2C = '';
  $Line = '';
  $ExpectedDate = '';
  $ReasonList = '';
  $Description = '';
}
}
<input type="text" name="RequestorName" placeholder="Enter Name" class="form-control" value="<?php echo $RequestorName; ?>" />
     </div>
      <div class="form-group">
      <label>SESA ID of Requestor</label>
      <input type="text" name="SESAID" placeholder="Enter SESA ID" class="form-control" value="<?php echo $SESAID; ?>" 
      </div>


On clicking Submit the values entered on the form will move to Excel. This operation works for me. I want to know how to implement it with MySQL. Everything I read is just going over my head.