
<p>
CustomerSearch Table:<br />
<form action="customersearch.php" method="post">
FirstName:<br />
<input type="varchar" name="FirstName" size="10" maxlength="32" value="" /><br />
LastName:<br />
<input type="varchar" name="LastName" size="10" maxlength="32" value="" /><br />
<input type="submit" value="Search!" />
</form>
</p>


<?php

if (isset($_POST['FirstName']) || isset($_POST['LastName']))
{

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

	$FirstName = mysql_real_escape_string($_POST['FirstName']);
	$LastName = mysql_real_escape_string($_POST['LastName']);

	$query = "SELECT * FROM customer WHERE FirstName LIKE '$FirstName%' AND LastName LIKE '$LastName%'";

	$result = mysql_query($query);

	$num_rows = mysql_numrows($result);

	$num_fields = mysql_numfields($result);

	for($count = 0; $count < $num_rows; $count++)
	{
		$CustomerID = mysql_result($result, $count, "CustomerID");
		$FirstName = mysql_result($result, $count, "FirstName");
		$MiddleInitial = mysql_result($result, $count, "MiddleInitial");
		$LastName = mysql_result($result, $count, "LastName");
		$Gender = mysql_result($result, $count, "Gender");
		$Address = mysql_result($result, $count, "Address");
		$Address2 = mysql_result($result, $count, "Address2");
		$City = mysql_result($result, $count, "City");
		$State = mysql_result($result, $count, "State");
		$ZipCode = mysql_result($result, $count, "ZipCode");
		$PhoneNumber = mysql_result($result, $count, "PhoneNumber");


		echo "CustomerID: $CustomerID <br>";
		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>";
	}

	mysql_close();
}

?>

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