带有编辑/删除链接的PHP动态表可打开弹出窗口

I built a form where user can enter Country Name and Country's Dialing Code. That form submits to Database and then I pull the record from database in a Table showing Country Name, Country's Dialing Code and two more options of EDIT and DELETE (having GET URL Link e.g. www.abc.com/country.php?country=Pakistan)

I want to add AJAX to it so that when user clicks on EDIT or DELETE link a relevant pop-up open with data from GET URL.

Following is my Dynamic Table in PHP

<div> 
<?php 
    $q = "SELECT * FROM country";
    $result = mysqli_query($conn, $q);
    echo "<table border=2><tr><th>Country Name</th><th>Country Code</th><th></th><th></th></tr>";

    while($a = mysqli_fetch_array($result)) { 
        $cn = $a['cname'];
        $cc = $a['ccode'];
?>
<tr>
<td><?php echo $cn ?></td> <td><?php echo $cc; ?></td>
<script type="text/javascript"> 
    var a = 0;
    var cname = new Array("<?php echo $cn;?>");
    a++;
</script>
<td>
    <a href='#' onclick='javascript:editWin(cname[a]); return(false);'>Edit</a>
</td>
<td id="<?php echo $cn;?>">
    <a href='#' onclick='javascript:delWin(); return(false);'>Remove</a>
</td>
</tr>
<?php       
    }
?>
</div>

My external Javascript Function is as follows

function editWin(e) {
    window.open('edit.php?country='+e,'','height=400, width=600, top=100,
                 left=400, scrollable=no, menubar=no', '');
};

In GET Url it says undefined when popup window opens.

I got the solution

My PHP Code is as follows

<div> <?php 

                    $q = "SELECT * FROM country";
                    $result = mysqli_query($conn, $q);

                    echo "<table border=2><tr><th>Country Name</th><th>Country Code</th><th></th><th></th></tr>";

                    while($a = mysqli_fetch_array($result)) { 

                                $cn = $a['cname'];
                                $cc = $a['ccode'];
                                ?>


                            <tr>

                            <td><?php echo $cn ?></td> <td><?php echo $cc; ?></td>
                            <td><a href='#' id="<?php echo $cn; ?>" onclick='javascript:editWin(this.id); return(false);'>Edit</a></td>
                            <td><a href='#' id="<?php echo $cn; ?>" onclick='javascript:delWin(this.id); return(false);'>Remove</a></td></tr>
                    <?php       

                    }

            ?>
    </div>

and my Javascript is as follows

function editWin(e) {
window.open('edit.php?country='+e,'','height=400, width=600, top=100, left=400, scrollable=no, menubar=no', '');
};                              

function delWin(e) {
window.open('del.php?country='+e,'','height=400, width=600, top=100, left=400, scrollable=no, menubar=no', '');
};