Working on my 'final project' for a college level php course. My final project is a store selling ebooks . . .
Hopefully I can describe my problem accurately . . .
My index page has a search function which posts a 'searchterm' and a 'searchtype'
to a new php page named 'results.php'. Searchterm is a text box where user can enter words, and searchtype is a dropdown for 'title' 'author' or 'isbn'. This has worked for a long time. A snippet:
$searchtype=$_POST['searchtype'];
$searchterm=$_POST['searchterm'];
$searchterm= trim($searchterm);
if (!$searchtype || !$searchterm) {
echo 'You have not entered search details. Please go back and try again.';
exit;
}
My problem has occured because I have now added a shopping cart display to the page, and links to the search results (which display book info & picture) to add items to the cart . . . With this line of code:
echo "<a href='cart.php?action=add_item&isbn=".$isbn."&qty=1'>Add Item To Shopping Cart</a>";
This line indeed adds the item to the cart (table in db) - however when the 'results.php' reloads it gives me:
You have not entered search details. Please go back and try again.
from above because there is no 'searchterm' or 'searchtype'.
So, how can I pass those variables from 'results.php' to 'cart.php' and back to 'results.php' . . . Or, what should I do?
As always any help is truly appreciated!
Thanks
Len