When I click the Edit button on any record, it will fetch the first data Please inform me, Thank you : I have a problem
When I click the Edit button on any record, it will fetch the first data
Please inform me,
Thank you
I have a problem
When I click the Edit button on any record, it will fetch the first data
Please inform me,
Thank you
I have a problem
When I click the Edit button on any record, it will fetch the first data
Please inform me,
Thank you

    <?php
    include("../include/connect.php");
    $gid = (empty($_GET['cu_id']));
    if (isset($_POST['cu_id'])) {
    $id = $_POST['cu_id'];
    }
    if (isset($_POST['cu_name'])) {
    $customer = $_POST['cu_name'];
    }
    if (isset($_POST['email'])) {
    $email = $_POST['email'];
    }
    if (isset($_POST['phone'])){
    $phone =($_POST['phone']);
    }
    if (isset($_POST['password'])) {
    $pass =$_POST['password'];
    }
    if (isset($_POST['coun_id'])) {
    $counter =$_POST['coun_id'];
    }
    if (isset($_POST['card_id'])){
    $card_id =$_POST['card_id'];
    }
    $q=mysqli_query($conn,"SELECT * FROM customer WHERE cu_id ='".$gid."'")or 
    die (mysqli_error());
    $r = mysqli_fetch_assoc ($q);
    if (isset($_REQUEST['edit']) AND $_REQUEST['edit'] == 'customer') {
    echo "
    <form action= '' method ='post' class'input_type'>
    <input type='text' name='cu_name' value='".$r['cu_name']."'/><br/>
    <input type='text' name='email' value='".$r['email']."'/><br/>
    <input type='text' name='phone' value='".$r['phone']."'/><br/>
    <input type='text' name='password' value='".$r['password']."'/><br/>
    <input type='text' name='coun_id' value='".$r['coun_id']."'/><br/>
    <input type='text' name='card_id' value='".$r['card_id']."'/><br/>
    <input type='submit' value='save edit' id='sends'/><br/>
    <input type='hidden' name='cu_id' value='".$gid."'/><br/>
    <input type='hidden' name='edit' value='customer'/><br/>
    </form>";
    }
    /* query */
    $query=mysqli_query($conn,"SELECT * FROM customer order by cu_id desc")or 
    die (mysqli_error());
    echo "<center>";
    echo"<table width='40%' border='1'cellpadding='5' id='ttb' >
    <tr>
    <th>cu id </th>
    <th>cu name</th> 
    <th>email </th>
    <th>phone </th>
    <th> coun id</th>
    <th> card id</th>
    <th> update</th>
    <th>delete</th>
    </tr>";
    while($row = mysqli_fetch_assoc($query)){
    echo "
    <tr>
    <td>".$row['cu_id']."</td>
    <td>".$row['cu_name']."</td>
    <td>".$row['email']." </td>
    <td>".$row['phone']." </td>
    <td> ".$row['coun_id']."</td>
    <td> ".$row['card_id']."</td>
    <td>
    <a href='cucontrol.php?edit&id=".$row['cu_id']."'>edit</a></td>
    </td>
    <td><a href='cucontrol.php?delete=user&id=".$row['cu_id']."'>delete</a></td>
    </tr>";
    }
    echo "</table>";
    echo "</center>";
    echo "</div>";
    mysqli_close($conn);
    ?>
