Hello. I take data from table and substitute them to other table. I'm take necessary data, substituted id to other table, instead #sel1 on selected file. I'm not seeing a mistake

Hello. I take data from table and substitute them to other table. I'm take necessary data, substituted id to other table, instead #sel1 on selected file. I'm not seeing a mistake

select data from table PHP <td> <div><strong> <select class="form-control" id="sel1" name="sel1"> <option value="" selected="selected">Select:</option> <?php $sql = "SELECT id, mo_number FROM filters"; $resultSet = mysqli_query($conn, $sql) or die("database error:".
mysqli_error($conn)); while( $rows = mysqli_fetch_assoc($resultSet) ) { ?> <option value="<?php echo $rows["id"]; ?>">
<?php echo $rows["mo_number"]; ?></option> <?php } ?> </select> </strong></div> </td>

PHP

include 'crud.php'; $object = new Crud(); if(isset($_POST["action"])) { if($_POST["action"] == "Load") { echo $object->get_data_in_table
("SELECT * FROM crud ORDER BY week DESC"); } if($_POST["action"] == "Insert") { $week1 = mysqli_real_escape_string($object->connect, $_POST["week1"]); $sel1 = mysqli_real_escape_string($object->connect, $_POST["sel1"]); $filter_name = mysqli_real_escape_string($object->connect, $_POST["filter_name"]); $quantity = mysqli_real_escape_string($object->connect, $_POST["quantity"]); $message = mysqli_real_escape_string($object->connect, $_POST["message"]); $filter_img = $object->upload_file($_FILES["filter_img"]); $filter_img2 = $object->upload_file($_FILES["filter_img2"]); $filter_img3 = $object->upload_file($_FILES["filter_img3"]); $query = " INSERT INTO crud (week, sel1, first_name, last_name, message,image, image2, pdf_files) VALUES ('".$week1."', '".$sel1."', '".$filter_name."', '".$quantity."', '".$message."', '".$filter_img."', '".$filter_img2."', '".$filter_img3."')"; $object->execute_query($query); } if($_POST["action"] == "Fetch Single Data") { $output = ''; $query = "SELECT * FROM crud WHERE id = '".$_POST["user_id"]."'"; $result = $object->execute_query($query); while($row = mysqli_fetch_array($result)) { $output["week1"] = $row['week1']; $output["sel1"] = $row['sel1']; $output["filter_name"] = $row['filter_name']; $output["quantity"] = $row['quantity']; $output["message"] = $row['message']; $output["filter_img"] = '<img src="upload/'.$row['filter_img'].'" class="img-thumbnail" width="50" height="35" />'; $output["filter_img2"] = '<img src="upload/'.$row['filter_img2'].'" class="img-thumbnail" width="50" height="35" />'; $output["filter_img3"] = '<img src="upload/'.$row['filter_img3'].'" class="img-thumbnail" width="50" height="35" />'; $output["filter_img"] = $row['filter_img']; $output["filter_img2"] = $row['filter_img2']; $output["filter_img3"] = $row['filter_img3']; } echo json_encode($output); }

ajax
$('#filter_form').on('submit', function(event){ event.preventDefault(); var sel1 = $('#sel1').val(); var filter_Name = $('#filter_name').val(); var quantity = $('#quantity').val(); var message = $('#message').val(); var extension = $('#filter_img').val().split('.').pop()
.toLowerCase(); if(extension != '') { if(jQuery.inArray(extension, ['gif','png','jpg','jpeg']) == -1) { alert("Invalid Image File"); $('#filter_img').val(''); return false; } } var extension2 = $('#filter_img2').val().split('.').pop()
.toLowerCase(); if(extension2 != '') { if(jQuery.inArray(extension2,
['gif','png','jpg','jpeg']) == -1) { alert("Invalid Image File"); $('#filter_img2').val(''); return false; } } var filter_img3 = $('#filter_img3').val().split('.')
.pop().toLowerCase(); if(filter_form != '' && quantity != '') { $.ajax({ url:"action.php", method:'POST', data:new FormData(this), contentType:false, processData:false, success:function(data) { alert(data); $('#filter_form')[0].reset(); load_data(); $("#sel1").val("Insert"); $("#action").val("Insert"); $('#button_action').val("Insert"); $('#uploaded_image').html(''); $('#uploaded_image2').html(''); $('#uploaded_pdf_files').html(''); } }); } else { alert("Both Fields are Required"); } });