0

I am creating a phone list with name and numbers. when i want to edit those numbers i run into the problem.

Currently i just iterrate through the DB and create a list of text fields

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
  </head>
    <body>    
    <form action="php/tlf-edit.php" method="POST" >
            <input type="submit" value="opdater valgte">
            <br> <br>
            <?php
              include('../phpconf/db.ini');
        $id = 1;
              $sql = mysqli_query($connect,"SELECT * FROM telefon");
              while ($row = mysqli_fetch_array($sql))
              {
              echo "<input type='Hidden' value='" . $row['id'] ."' name='id'><input type='text' value='" . $row['Navn'] . "' name='Name'> - <input type='text' name='Number' value='"  . $row['Nummer'] ."'><br>";
        }
          ?>
      </form>
  </body>
</html>

But when i pass it to the php file, it only submits the last entry and not all of them. i tried using a foreach - but it gave the same issue. only passing the last entry.

if someone could guide me in the right direction i would very much appriciate it :)

0 Answers0