I'm trying to simulate an online bookstore.
1)The user enters the search details
2)based on the search details the matched books' details (title, author and price) are displayed in a new page.
3)Then, the user clicks a particular book title link, and more info abt the book is displayed in a new page.
The program works fine for step 1 and 2. The problem is in step 3.
search_eg_vs2.php
......
......
while ($row=mysql_fetch_array($result))
{
echo '<tr><td><a href="book_det.php?title='.$row['title'].'">'.$row['title'].'</a></td>
<td>'.$row['price'].'</td>
<td>'.$row['author'].'</td></tr>';
}
......
......
code snippet in book_det.php
$_SESSION['title'] = $_POST['title'];
echo "Sessions: <pre>";
print_r($_SESSION);
echo "</pre>";
$sql = "Select * from books where title= '".$_SESSION['title']."'";
echo "$sql";
$result = mysql_query($sql)or die(mysql_error());
$row = mysql_fetch_row($result);
echo "<br>";
echo "ISBN" . $row[0] . "<br>";
echo "Book Title".$row[1]."<br>";
echo "Price" . $row[2] . "<br>";
echo "Author" . $row[3] . "<br>";
echo "Publisher" . $row[4] . "<br>";
This is the output when I click on one of the book titles on the table.
Sessions:
Array
(
[title] =>
)
Select * from books where title= ''
ISBN
Book Title
Price
Author
Publisher
The problem is the title is not being passed to book_det.php. How do I solve this?
Thank you.
ladygandhi