$user ='root';
    $pass = '';
    $db = 'sad';
    $con =mysqli_connect($host,$user,$pass,$db);
    ?>
    <!DOCTYPE html>
    <html>
        <head>
            <title>ADMIN</title>
        <style>
        table,th,td
        {
        border: 1.5px solid black;
        }
        </style>
        <script>
            function approve()
            {
                <?php
                  $hide = $_POST['omg'];
                  $qwe = "INSERT INTO `enrolled` SELECT * FROM `new` WHERE `id` = '$hide' ";
                ?>
            }
        </script>
        </head>
    <body>
        <form method='POST'>
            <table width=500px >
                <?php 
                $sql = "SELECT * FROM New";
                $result = mysqli_query($con, $sql);
                if (mysqli_num_rows($result) > 0) {
                while($row = mysqli_fetch_assoc($result)) {
                echo "<form method='POST'><tr><td>ID: " . $row["id"]. "<br>FIRSTNAME: " . $row["fname"]. "<br>MIDDLENAME: " . $row["mname"]. "<br>LASTNAME : " . $row["lname"]. "<br>COURSE: " . $row["course"]. "<br>ADDRESS: " . $row["address"]. "<br>CONTACT: " . $row["contact"] . "<br><br><input type='text' name='omg' value=$row[id]> <input type='button' name= 'btn' value='Approve' onclick=approve()></td></tr></form>";
                }
                }
                else
                {
                    echo "No Request Sent!";
                }
                ?>
            </table>
        </form>
    </body>
    </html>
Can you guys help me ? the variable $hide does not contains any amount but my code states that $hide = $_POST['omg'] . omg is the name of the textbox and that textbox contains the id .
my code works if i erase the WHERE id= 'hide' , yet it will copy all data of the table 'new' to table 'enrolled'. but what i need is to copy a single row data in the table 'new' and transfer it to table 'enrolled' .
please help me . i already made so many trials. :(
