Displaying data from another php site

I am having trouble displaying my bookISBN on another php site. Actually, my first php page, I brought the table data to the table. And now I want the user to click on the title of the book and open a new php page where it shows the details of the books.

This is my first php page code:

echo "<table width = \"1000px\" border = \"1\" cellpadding = \"1\" cellspacing=\"1\">";
echo "<tr>";
echo "<th>".'Book ISBN'."</th>";;
echo "<th>".'Book Title'."</th>";
echo "<th>".'Book Year'."</th>";
echo "<th>".'Category ID'."</th>";
echo "<th>".'Category Description'."</th>";
echo "<th>".'Book Price'."</th>";
echo "<tr>";

if($booknum >= 1 ){
echo "<div style='margin: 0 0 10px 0; font-weight: bold;'>$booknum record(s) found!</div>";
while ($row = mysqli_fetch_assoc($bookrs)) {
    echo "<tr>";
    echo "<td><center>" . $row['bookISBN']."</center></td>";
    echo "<td><center><a href=\"bookdetails.php\">" .$row['bookTitle']. "</a></center></td>";
    echo "<td><center>" . $row['bookYear']."</center></td>";
    echo "<td><center>" . $row['catID']."</center></td>";
    echo "<td><center>" . $row['catDesc']."</center></td>";
    echo "<td><center>" . $row['bookPrice']."</center></td>";
    echo "</tr>";
}

Now I want to know how to get the ISBN number of the book so that I can display it on my second php page. I would be glad if someone could help me.

0
source share
3 answers

echo "<td><center><a href=\"bookdetails.php?book=".$row['bookISBN']."\">" .$row['bookTitle']. "</a></center></td>";

bookdetails.php you can access using $_REQUEST['book']

Disable site

0
source

Add a new parameter to the URL.

echo '<td><center><a href="bookdetails.php?bookISBN=' . $row['bookISBN'] . '">' .$row['bookTitle']. '</a></center></td>';

bookdetails.php

$bookISBN = ! empty($_GET['bookISBN']) ? $_GET['bookISBN'] : '';
0

href

 echo "<td><center><a href=\"bookdetails.php?bookid=" .$row['bookId']. "\">" .$row['bookTitle']. "</a></center></td>";
0

Source: https://habr.com/ru/post/1568631/


All Articles