Can someone help, I cant seem to get the data colleted from the form to be sent to the mysql database.
I am very new to coding and I cant seem to figure out why the form data is not being sent to the mysql database table.
Please any help would be muchly appricated. once I press submit the page closes than refreshs without any errors, but the data has not been sent to the database table.
Please see code below.
<?php include'inc/header.php'; ?>
<div class="container">
    <center>
        <h2 style="color: #odc16f">Shipped</h2>
        <hr>
    </center>
    <center>
        <!-- Button trigger modal -->
        <button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#addEmpModal">
            Add Order
        </button>
    </center>
    <!-- Modal -->
    <div class="modal fade" id="addEmpModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <form action="" method="post">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria- hidden="true">×</span></button>
                        <h4 class="modal-title" id="myModalLabel">Add New Order</h4>
                    </div>
                    <div class="modal-body">
                        <div class="form-group">
                            <label>Enter Name</label>
                            <input class="form-control" type="text" name="customer" id="customer" placeholder="Enter Name">
                            <label id="lbcustomer" style="color:red"></label>
                        </div>
                        <div class="form-group">
                            <label>Enter Date</label>
                            <input class="form-control" type="date" name="date" id="date" placeholder="Enter Date">
                            <label id="lbdate" style="color:red"></label>
                        </div>
                        <div class="form-group">
                            <label>Enter Invoice</label>
                            <input class="form-control" type="number" name="invoice" id="invoice" placeholder="Enter Invoice">
                            <label id="lbinvoice" style="color:red"></label>
                        </div>
                        <div class="form-group">
                            <label>Enter eBay</label>
                            <input class="form-control" type="number" name="ebay" id="ebay" placeholder="Enter eBay">
                            <label id="lbebay" style="color:red"></label>
                        </div>
                        <div class="form-group">
                            <label>Enter Shipped</label>
                            <input class="form-control" type="text" name="shipper" id="shipper" placeholder="Enter Shipped">
                            <label id="lbshipper" style="color:red"></label>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                        <button type="button" class="btn btn-primary" id="save">Save changes</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div><!-- /.container ends here -->
<?php
    include'inc/footer.php';
?>
<script>
    $(document).ready(function() {
        $(document).on('click', '#save', function() {
            var customer = $("#customer").val();
            var date = $("#date").val();
            var invoice = $("#invoice").val();
            var ebay = $("#ebay").val();
            var shipper = $("#shipper").val();
            if (customer == "") {
                $("#lbcustomer").html("Enter Name");
            } else if (date == "") {
                $("#lbdate").html("Enter Date");
            } else if (invoice == "") {
                $("#lbinvoice").html("Enter Invoice");
            } else if (ebay == "") {
                $("#lbebay").html("Enter eBay");
            } else if (shipper == "") {
                $("#lbshipper").html("Enter Shipper");
            } else {
                $.ajax({
                    url: "save_data.php",
                    type: "post",
                    data: {
                        customer: customer,
                        date: date,
                        invoice: invoice,
                        ebay: ebay,
                        shipper: shipper
                    },
                    success: function(data) {
                        alert("Order Has Been Successful");
                        $("#addEmpModal").modal('hide');
                        location.reload();
                    }
                });
            }
        });
    });
</script>
Please see below the save_data.php code
<$php
include 'config/config.php';
global $con;
   $customer = $_POST['customer'];
   $date = $_POST['date'];
   $invoice = $_POST['invoice'];
   $ebay = $_POST['ebay'];
   $shipper = $_POST['shipper'];
$save_data = "INSERT INTO orders(customer, date, invoice, ebay, shipper)VALUES('$customer','$date','$invoice','$ebay','$shipper')";
$result = mysqli_query($con, $save_data);
and below is the config.php code.
<?php
$con = mysqli_connect("localhost","root","Password","shippedorders");
if (!$con) {
  echo "Failed to connect to MySQL: ".mysqli_connect_error($con);
  } 
 
    