<!-- this form searches for a contact by their email address -->
	<H1>Search for a contact</H1>
	<form action="index.php" method="post">
		<input type="hidden" name="action" value="search" />
		<input type="text" name="searchEmailAddress" maxlength="50">
		<input type="submit" name="submit" value="Submit" />
	</form>
	<!-- The HTML code from here to the end is Preformatted so that the information returned by the API is readable.-->
	<pre>
	
<?php 
    // Check to make sure that we have a search result. Is $search == false then we did not find any contacts.
    if ($search != false) {
        if ($_POST["action"] == "delete") {
            // If the user clicked on the Unsubscribe Contact button then we will want to unsubscribe them.
            $ConstantContact->DeleteContact($search[0]);
        } else {
            // the only action left is a basic search, so we will get the Contact details and display them.
            //First we will get the Contact Details from the Wrapper.
            $details = $ConstantContact->getContactDetails($search[0]);
            //Then we will let the user know that a contact exists with that email address
            echo $details->emailAddress . " Exists";
            ?>

<!-- Create a button allowing the user to unsubscribe the contact. This button is functional. DO NOT use it unless you have access to the email address being unsubscribed. -->
<form action="index.php" method="post">
<input type="hidden" name="action" value="delete" />
<input type="hidden" name="searchEmailAddress" value="<?php 
            echo $details->emailAddress;
            ?>
" />