Jump to content

knightsofthesea

New Members
  • Posts

    1
  • Joined

  • Last visited

knightsofthesea's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I need some help please with mysql statement loop with a post form. I have displayed it as basic as I can. It populates fine. and it displays as a list with each persons details and a post button . But when I press the Post button of any on the list, the form gets populated with the first person on the list. I am a newbee thanks. <!DOCTYPE html> <html> <head> </head> <body> <?php // Create connection $conn = new mysqli($servername, $username, $password, $dbname); /// Check SQL connection if ($conn->connect_error) { echo"myerror"; // Get the the data from the database $sql = "SELECT * FROM details WHERE enrollid ='$enrollid' "; $result = $conn->query($sql); // Check database connection first if ($conn->query($sql) === FALSE) { echo"myerror"; } // If database connection is okay and sql connection else if ($result->num_rows > 0) { // output data of each row while($row = $result->fetch_assoc()) { ?> <div class="col-md-3 bid-section"> <!-- Favourites --> <form action="" method="post" > <!-- Favourites --> <input type="text" class ="firstname" name="" value="<?php echo $row['firstname'];?>"> <input type="text" class ="surname" name="" value="<?php echo $row['surname'];?>"> <input type="text" class ="country" name="" value="<?php echo $row['country'];?>"> <a class ="favourite-btn" > <div class="'.$favicon.'"></div> </a> </form> <div> <?php } }else { echo 'No Details'; } mysqli_free_result($result); mysqli_close($conn); ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.