I have a page that displays products from a database. I have the functions for the cart on an external page. Products page as follows:
<?php
// Include MySQL class
require_once('inc/mysql.class.php');
// Include database connection
require_once('inc/global.inc.php');
// Include functions
require_once('inc/functions.inc.php');
// Start the session
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
<html xmlns=" xml:lang="en" lang="en">
<head>
<title>Catalogue</title>
<link rel="stylesheet" href="css/styles.css" />
</head>
<body>
<div id="shoppingcart">
<h1>Your Shopping Cart</h1>
<?php
echo writeShoppingCart();
?>
</div>
<div id="vacList">
<h1>Our Store </h1>
<?php
$sql = 'SELECT * FROM store_items ORDER BY id';
$result = $db->query($sql);
$output[] = '<ul>';
while ($row = $result->fetch()) {
$output[] = '<li>"'.$row['item_title'].'" desc '.$row['item_desc'].': $'.$row['item_price'].'<br /><a href="cart.php?action=add&id='.$row['id'].'">Add to cart</a></li>';
}
$output[] = '</ul>';
echo join('',$output);
?>
</div>
</body>
</html>
It displays on the page from the database but does not parse the selected item to the cart.php page. Do you need the functions script?
<?php
// Include MySQL class
require_once('inc/mysql.class.php');
// Include database connection
require_once('inc/global.inc.php');
// Include functions
require_once('inc/functions.inc.php');
// Start the session
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
<html xmlns=" xml:lang="en" lang="en">
<head>
<title>Catalogue</title>
<link rel="stylesheet" href="css/styles.css" />
</head>
<body>
<div id="shoppingcart">
<h1>Your Shopping Cart</h1>
<?php
echo writeShoppingCart();
?>
</div>
<div id="vacList">
<h1>Our Store </h1>
<?php
$sql = 'SELECT * FROM store_items ORDER BY id';
$result = $db->query($sql);
$output[] = '<ul>';
while ($row = $result->fetch()) {
$output[] = '<li>"'.$row['item_title'].'" desc '.$row['item_desc'].': $'.$row['item_price'].'<br /><a href="cart.php?action=add&id='.$row['id'].'">Add to cart</a></li>';
}
$output[] = '</ul>';
echo join('',$output);
?>
</div>
</body>
</html>
It displays on the page from the database but does not parse the selected item to the cart.php page. Do you need the functions script?