HTML PHP数据库 - 编辑/删除按钮 - 传递值

im rather amateur with php and even more so with js. I have created a database table with an edit & delete button, as shown in the screenshot. (if anyone is also able to see why there is a gap between my header and body of table that would be great, i have no clue why this is cropping up, doesnt seem to be css).

The idea is to just click the delete button, pass the 'AwbNo' over to the delete.php page in order to delete the entire row from the database, and then automatically return to the page to see the updated table, if redirection can be avoided, even better just to make the operation smoother. Any help would be greatly appreciated, hope my code below is enough for aid

so select a row to delete>click delete>confirmation>row deleted from db. That is the process i am aiming to achieve

example database screenshot

<table class="table">
                <thead>
                  <tr>
                    <th>Awb Number</th>
                    <th>Vessel</th>
                    <th>Client</th>
                    <th>Pieces</th>
                    <th>Total Weight</th>
                    <th>Carrier</th>
                    <th>Sender</th>
                    <th>Status</th>
                    <th>Arrival Date</th>
                    <th>Action</th>
                  </tr>
                </thead>
                <tbody>
                    <?php               //BEGINNING OF PHP
                    include("login/dbinfo.inc.php");
                    $comm=@mysql_connect(localhost,$username,$password);
                    $rs=@mysql_select_db($database) or die( "Unable to select database"); 

                    $sql="SELECT AwbNo, VesselName, ClientCode, Pieces, Weight, Carrier, Sender, Status, DATE_FORMAT(ArrivalDate, '%d-%m-%yyyy') FROM tbl_import";
                    $result = mysql_query($sql) or die("SELECT Error: ".mysql_error());
                    $num_rows = mysql_num_rows($result);
                    echo "<p>There are $num_rows records in the Customer table.</p>";
                    echo "<table class=\"table\">
";
                    while ($get_info = mysql_fetch_array($result))
                    {
                        echo ("<tr>
");
                        echo ("<td>".$get_info["AwbNo"]."</td>");
                        echo ("<td>".$get_info["VesselName"]."</td>");
                        echo ("<td>".$get_info["ClientCode"]."</td>");
                        echo ("<td>".$get_info["Pieces"]."</td>");
                        echo ("<td>".$get_info["Weight"]."</td>");
                        echo ("<td>".$get_info["Carrier"]."</td>");
                        echo ("<td>".$get_info["Sender"]."</td>");
                        echo ("<td>".$get_info["Status"]."</td>");
                        echo ("<td>".$get_info["ArrivalDate"]."</td>");
                        ?>
                            <td>
                            <div id="outer">
                                <div class="inner"><button type="submit" class="msgBtn" onClick="goToURL()" > Edit </button></div>
                                <div class="inner"><button type="submit" class="msgBtn2" onClick="goToURL1()"> Delete </button></div>
                                </div> 
                            </td>
                        <?php
                        echo ("</tr>
");
                    }
                    echo "</table>
";
                    mysql_close();
                    ?>                  <!--END OF PHP-->
                </tbody>
                </table>

Below is the js script to redirect user page when clicking on the 'edit' or 'delete' button.

<script>
function goToURL() {
window.open('php/edit.php');
}
function goToURL1() {
  window.open('php/delete.php');
}
</script>

And below is the supposing 'delete.php' page to delete the record from the db on a live server, this is only an example, im not exactly sure if it is correct.

<?php
        include("dbinfo.inc.php");
        $comm=@mysql_connect(localhost,$username,$password);
        $rs=@mysql_select_db($database) or die( "Unable to select database"); 
        $AwbNo=$_POST['AwbNo'];
        $sql="DELETE FROM  tbl_import where AwbNo=$AwbNo";
        mysql_query($sql)or die("Delete Error: ".mysql_error());
        mysql_close();
        echo "Record was successfully deleted.
";
        ?>

Welcome to StackOverflow!

The issue your having is because you need to pass the primary key that AwbNo in you case, along with the Edit /Delete link, so that the correct record is selected from DB. This is not happening in your case.

The code for the table needs to look something like mentioned below for the edit & delete links.

echo '<td><a href="edit.php?id='.$get_info['AwbNo']. '">&nbspEdit&nbsp</a></td>';
echo '<td><a href="javascript:delete_user('.$get_info['AwbNo']. ')">&nbspDelete&nbsp</a></td>'

Also add this script in same page.

 <script>
        function delete_user(uid)
        {
            if (confirm('Are You Sure to Delete this Record?'))
            {
                window.location.href = 'delete.php?id=' + uid;
            }
        }
    </script> 

delete.php can have just this code:

  <?php

        include("dbinfo.inc.php");
        $comm=@mysql_connect(localhost,$username,$password);
        $rs=@mysql_select_db($database) or die( "Unable to select database"); 
        $id = $_GET['id']; // $id is now defined
        mysqli_query($conn,"DELETE FROM tbl_import where AwbNo='".$id."'");
        mysqli_close($conn);
        header("Location: index.php"); //redirect to relevant page

    ?>