
<p>
CustomerInsert Table:<br />
<form action="CustomerInsert.php" method="post">

	FirstName:<br />
	<input type="text" name="FirstName" size="30" maxlength="30" value=""/>
	</p>
	<p>

	MiddleInitial:<br />
	<input type="text" name="MiddleInitial" size="1" maxlength="1" value="" />
	</p>
	<p>

	LastName:<br />
	<input type="text" name="LastName" size="30" maxlength="30" value="" />
	</p>
	<p>

	Gender:<br />
	<input type="text" name="Gender" size="1" maxlength="1" value="" />
	</p>
	<p>

	Address:<br />
	<input type="text" name="Address" size="30" maxlength="30" value="" />
	</p>
	<p>

	Address2:<br />
	<input type="text" name="Address2" size="30" maxlength="30" value="" />
	</p>
	<p>

	City:<br />
	<input type="text" name="City" size="30" maxlength="30" value="" />
	</p>
	<p>

	State:<br />
	<input type="text" name="State" size="2" maxlength="2" value="" />
	</p>
	<p>

	ZipCode:<br />
	<input type="text" name="ZipCode" size="10" maxlength="10" value="" />
	</p>
	<p>

	PhoneNumber:<br />
	<input type="text" name="PhoneNumber" size="12" maxlength="12" value="" />
	</p>
	<p>

<input type="submit" name="submit" value="Submit!" />
</p>
</form>

<?php

if (isset($_POST['FirstName']) && isset($_POST['MiddleInitial']) && 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']);
	$MiddleInitial = mysql_real_escape_string($_POST['MiddleInitial']);
	$LastName = mysql_real_escape_string($_POST['LastName']);
	$Gender = mysql_real_escape_string($_POST['Gender']);
	$Address = mysql_real_escape_string($_POST['Address']);
	$Address2 = mysql_real_escape_string($_POST['Address2']);
	$City = mysql_real_escape_string($_POST['City']);
	$State = mysql_real_escape_string($_POST['State']);
	$ZipCode = mysql_real_escape_string($_POST['ZipCode']);
	$PhoneNumber = mysql_real_escape_string($_POST['PhoneNumber']);


	$CustomerID = $FirstName ."".$MiddleInitial ."".$LastName;
	$CustomerID = md5($CustomerID);

	$query = "INSERT INTO customer VALUES('$CustomerID', '$FirstName', '$MiddleInitial', '$LastName',
	'$Gender', '$Address', '$Address2', '$City', '$State', '$ZipCode', '$PhoneNumber')";

	$result = mysql_query($query);

	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>
