在保存时通过Ajax运行UPDATE查询

I have a form with multiple different inputs. Two parts of the form are a dropdown box and three contact info input boxes. Whenever I make a selection in my dropdown box, it auto-populates information into the text boxes. I also have a Save button next to the text boxes. This should allow me to update that field if it needs changed once I hit the save button. So for example, it works if I hardcode the dropdown box value in to my update statement, but I cant get it to work without hardcoding it.

How would I be able to fix this? Since this is already in a form, I am not running this on SUBMIT. I am simply clicking a save button within the form, that automatically updates the information.

Dropdown box code:

<div>
<div id="vendor">
<strong>Vendor:</strong>
</div> 

<div class="align">
<select name="vendor_dropdown" id="ven" onChange="updateinput();">
    <option value="">Choose a Vendor</option>
        <?php foreach($users->fetchAll() as $user): ?>
            <option
                    data-name="<?php echo $user['MR_POC_N'];?>"
                    data-email="<?php echo $user['MR_POC_E'];?>"
                    data-phone="<?php echo $user['MR_POC_P'];?>"
            >
                <?php echo $user['MR_Name'];?>
            </option>
        <?php endforeach; ?>
</select>
</div>

</div>

Contact info code that is auto populated:

<div>
<div id="contact_info">
<strong>Contact Information:</strong><br>
</div>

<div class="align1">
<table align="left" id="contact">
<tr align="left">
    <th>Name</th>
    <th>Email</th>
    <th>Phone Number</th>
</tr>
    <tr>
        <td><input type="text" id="name" class="name" name="name"></td>
        <td><input type="email" id="email" class="email" name="email"></td>
        <td><input type="tel" id="tel" class="tel" name="number"></td>
        <td><input type="button" class="edit" name="edit" value="Save"></td>
    </tr>
</table>
</div>

</div>

Javascript for editing the info:

// ----- Edit Contact Info -----

$(document).on("click", "#contact .edit", function () {
  var $this = $(this);
  var tds = $this.closest('tr').find('td').filter(function () {
    return $(this).find('.edit').length === 0;
  });
  if ($this.val() === 'Edit') {
   /*if($this.id !== '.mr_id') {
        tds.not('.mr_id').not('.mr_name').prop('contenteditable', true);
   }*/
  } else {
    var isValid = true;
    var errors = '';
    $('#myDialogBox').empty();
    var elements = tds;
    if (tds.find('input').length > 0) {
      elements = tds.find('input');
    }
    var dict = {}; 
    elements.each(function (index, element) {
      var type = $(this).attr('class');
      var value = (element.tagName == 'INPUT') ? $(this).val() : $(this).text();
      console.log(type);
      // ----- Switch statement that provides validation for each table cell -----
      switch (type) {
        case "ven":
              dict["MR_Name"] = value;
            break;
        case "name":
          if (value == value.match(/^[a-zA-Z\s]+$/)) {
              dict["MR_POC_N"] = value;
            break;
          }
          else {
            isValid = false;
            errors += "Please enter a valid Name
";
          }
          break;
        case "email":
          if (value == value.match(/^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/)) {
              dict["MR_POC_E"] = value;
            break;
          }
          else {
            isValid = false;
            errors += "Please enter a valid Email
";
          }
          break;
        case "tel":
          if (value == value.match('^[0-9 ()+/-]{10,}$')) {
              dict["MR_POC_P"] = value;
            break;
          }
          else {
            isValid = false;
            errors += "Please enter a valid Phone Number
";
          }
          break;
      }
    })

    if (isValid) {
        console.log(dict);

    var selIndex = ven.selectedIndex;
    console.log();
    var selName = $( "#ven option:selected" ).text();

      //$this.val('Save');
      //tds.prop('contenteditable', false);
      var request = $.ajax({
      type: "POST",
      url: "update.php",
      data: { ven: selName, MR_Name: dict['MR_Name'], MR_POC_N: dict['MR_POC_N'],  MR_POC_E: dict['MR_POC_E'],  MR_POC_P: dict['MR_POC_P'] },
      success: function(data){
          console.log(selName);
          }
    });

        request.done(function (response, textStatus, jqXHR){
          if(JSON.parse(response) == true){
            console.log("Data saved");
          } else {
            console.log("Data failed to save");
            console.log(response);
            console.log(textStatus);
            console.log(jqXHR);
          }
        });

        // Callback handler that will be called on failure
        request.fail(function (jqXHR, textStatus, errorThrown){
            // Log the error to the console
            console.log(textStatus);
            console.log(jqXHR);
            console.error(
                "The following error occurred: "+
                textStatus, errorThrown
            );
        });

        // Callback handler that will be called regardless
        // if the request failed or succeeded
        request.always(function () {

        });
    } else {
      alert(errors);
    }
  }
});

update.php:

<?php

  $MR_Name = $_POST['ven'];
  $MR_POC_N = $_POST['MR_POC_N'];
  $MR_POC_E = $_POST['MR_POC_E'];
  $MR_POC_P = $_POST['MR_POC_P'];

  $host="xxxxxxx"; 
  $dbName="xxxxxxxxx"; 
  $dbUser="xxxx"; 
  $dbPass="xxxxxxxx";

  $pdo = new PDO("sqlsrv:server=".$host.";Database=".$dbName, $dbUser, $dbPass);

  $sql = "UPDATE Stage_Rebate_Master SET MR_POC_N = :MR_POC_N, MR_POC_E = :MR_POC_E, MR_POC_P = :MR_POC_P WHERE MR_Name = '$MR_Name'";

  $stmt = $pdo->prepare($sql);
  $stmt->bindValue(':MR_Name', $MR_Name);  
  $stmt->bindValue(':MR_POC_N', $MR_POC_N);
  $stmt->bindValue(':MR_POC_E', $MR_POC_E);
  $stmt->bindValue(':MR_POC_P', $MR_POC_P);  
  $result = $stmt->execute();
  echo json_encode($result);

?>

Try using this line of code instead of yours for the value declaration.

var selName = $("#ven").val();