$_GET laad geen info

Radio247

Gebruiker
Lid geworden
8 dec 2011
Berichten
36
Ik probeer een script als linken pagina te gebruiken om naar een volgende stap te gaan.
Hierbij moet er data worden meegenomen en dat wil ik met GET of POST doen.
Helaas heb ik na meerdere dagen testen en terug lezen in tutorials geen werkend script kunnen realiseren.
De uitlezing in de button's gaat goed maar die naam dient in de link te worden aangevuld en dat wil niet werken.
Iemand enig idee waar het fout kan gaan?

Code:
<?php
include 'connect.php';

   // connect the database with the server
   $conn = new mysqli($dbHost,$dbUser,$dbPass,$dbName);

mysqli_set_charset($conn, "utf8mb4");

    // if error occurs
    if ($conn -> connect_errno)
    {
       echo "Failed to connect to MySQL: " . $conn -> connect_error;
       exit();
    }

    $sql = "select * FROM country WHERE type='artist'";
    $result = ($conn->query($sql));
    //declare array to store the data of database
    $row = [];

    if ($result->num_rows > 0)
    {
        // fetch all data from db into array
        $row = $result->fetch_all(MYSQLI_ASSOC); 
    }   
?>

<!DOCTYPE html>
<html>
<style>
    td,th {
        border: 1px solid black;
        padding: 5px;
        margin: 5px;
        text-align: center;
    }
</style>

<body>
    <table>
        <thead>
            <tr>
                <th>Select artist or <a href = "search.php">SEARCH</a></th>
            </tr>
        </thead>
        <tbody>
            <?php
               if(!empty($row))
               foreach($row as $rows)
              {
            ?>
            <tr>
<!-- listing  artist names as a link -->
       <td>
        <form action="songs.php" method="GET">
         <input type="hidden" name="artist" value="<?php $rows['name']?>">
         <button type="submit"><?php echo $rows['name']?></button>
        </form>
       </td>

       </tr>
            <?php } ?>
        </tbody>
    </table>
</body>
</html>

<?php   
    mysqli_close($conn);
?>
 
Terug
Bovenaan Onderaan