
<p>
Search the store database:<br />
<form action="SaleSearch.php" method="post">
	SaleNum:<br />
	<input type="int" name="SaleNum" size="10" maxlength="10" value="" /><br />
	<input type="submit" value="Search!" />
	</form>
	</p>

<?php

if (isset($_POST['SaleNum']))
{

	$linkID = mysql_connect("localhost","root","ktm250") or die("No connection");
	mysql_select_db("newstore") or die("No connection");

	$SaleNum = mysql_real_escape_string($_POST['SaleNum']);

	$query = "SELECT * FROM sale WHERE SaleNum = '$SaleNum'";

	$result = mysql_query($query);

	$SaleNum = mysql_result($result, 0, "SaleNum");
	$CustomerID = mysql_result($result, 0, "CustomerID");

	echo "SaleNum: $SaleNum <br>";
	echo "CustomerID: $CustomerID <br>";
	echo "<br>";

	/**********************/
	$query = "SELECT * FROM customer WHERE CustomerID = '$CustomerID'";
	$result = mysql_query($query);

	$FirstName = mysql_result($result, 0, "FirstName");
	$MiddleInitial = mysql_result($result, 0, "MiddleInitial");
	$LastName = mysql_result($result, 0, "LastName");
	$Gender = mysql_result($result, 0, "Gender");
	$Address = mysql_result($result, 0, "Address");
	$Address2 = mysql_result($result, 0, "Address2");
	$City = mysql_result($result, 0, "City");
	$State = mysql_result($result, 0, "State");
	$ZipCode = mysql_result($result, 0, "ZipCode");
	$PhoneNumber = mysql_result($result, 0, "PhoneNumber");

	echo "FirstName: $FirstName <br>";
	echo "MiddleInitial: $MiddleInitial <br>";
	echo "LastName: $LastName <br>";
	echo "Gender: $Gender <br>";
	echo "Address: $Address <br>";
	echo "Address2: $Address2 <br>";
	echo "City: $City <br>";
	echo "State: $State <br>";
	echo "ZipCode: $ZipCode <br>";
	echo "PhoneNumber: $PhoneNumber <br>";
	echo "<br>";
	/************************/


	$query = "SELECT * FROM inventorycontrol WHERE SaleNum = '$SaleNum'";

	$result = mysql_query($query);

	$ShoeStockNum = mysql_result($result, 0, "ShoeStockNum");

	echo "ShoeStockNum: $ShoeStockNum <br>";
	echo "<br>";

	$query = "SELECT * FROM saledescription WHERE ShoeStockNum = '$ShoeStockNum'";

	$result = mysql_query($query);

	$ItemID = mysql_result($result, 0, "ItemID");
	$Color = mysql_result($result, 0, "Color");
	$Size = mysql_result($result, 0, "Size");
	$Width = mysql_result($result, 0, "Width");
	$Retail = mysql_result($result, 0, "Retail");

	echo "ItemID: $ItemID <br>";
	echo "Color: $Color <br>";
	echo "Size: $Size <br>";
	echo "Width: $Width <br>";
	echo "Retail: $Retail <br>";

	echo "<br>";

	mysql_close();
}

?>

<a href="index.html">Return to main...</a>
