How do I reference an item from database to a link in a php page?

December 06, 2019, at 03:10 AM

I am doing a reservation page where I have multiple links which redirect to a page where the reservation is made.

The link is displayed multiple times for every book in my database. It is in a while loop.

if(mysqli_num_rows($result_category) > 0) {
            while($row = mysqli_fetch_assoc($result_category)) {
               //... print each book then print the link to reserve
               echo "<a id=\"reservelink\" href=\"viewRes.php?id=". $isbn ."\">Reserve</a><br>";
         } else {
            echo "The chosen category has no books available";

I tried doing the code above for each book href=\"viewRes.php?id=". $isbn ...

But when I try to echo the $isbn on viewRes page it would not be echoed. is there a way to assign each item in the database to a specific $isbn value? Thanks in advance

Answer 1

Change php?id=". $isbn ." to php?id=". $row['isbn'] ."

Rent Charter Buses Company
PHP, dynamic form, access POST variables, checkboxes

PHP, dynamic form, access POST variables, checkboxes

I am trying to make dynamic form which will allow person to add multiple tooth data to the databaseThe problem I have is that after submitting the form I cant access the given variables and arrays(checkboxes) have only 1 value(first one)