<?
	// check for the existence of $name as a GET parameter
	if(!isset($_GET["name"]))
	{
		/* Redirect to a different page in the current directory that was requested */
		header("Location: index.php");
	}
	$name = $_GET["name"];
	// then check for the validity of the name using XPath query


	// check for the existence of $size as a GET parameter
	if(!isset($_GET["name"]))
	{
		header("Location: http://localhost/section3/index.php");
	}
	$size = $_GET["size"];
	// then check for the validity of the size using XPath query

	session_start();
	
	// add to cart using a key of the format ["cart"]["Onions.small"]
	$key = $name . "." . $size;
	$_SESSION["cart"][$key] = $_SESSION["cart"][$key] + 1;
	
	header("Location: cart.php");
?>