Lost in wordpress adn constant contact php

I am lost. I found some php that i integrated to a wordpress template page and can not get it to submit to the ConstantContact DB. Would someone be willing to help?

[php]<?php get_header(); ?>

		<article class="entry clearfix">
		<?php
			the_content();

			wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'Vertex' ), 'after' => '</div>' ) );
		?>

			<div id="et-contact" class="responsive">
<?php if ( ! isset( $_SESSION ) ) session_start(); /* Template Name: Constant Contact */ ?> <?php // require the autoloader require_once('../html/wp-content/themes/Vertex/Ctct/autoload.php'); //verified files are all there use Ctct\ConstantContact; use Ctct\Components\Contacts\Contact; use Ctct\Components\Contacts\ContactList; use Ctct\Components\Contacts\EmailAddress; use Ctct\Exceptions\CtctException; // Enter your Constant Contact APIKEY and ACCESS_TOKEN define("APIKEY", "KEY ID"); //verified both key and token define("ACCESS_TOKEN", "TOKEN ID"); $cc = new ConstantContact(APIKEY); // attempt to fetch lists in the account, catching any exceptions and printing the errors to screen - works try { $lists = $cc->getLists(ACCESS_TOKEN); } catch (CtctException $ex) { foreach ($ex->getErrors() as $error) { print_r($error); } } // check if the form was submitted if (isset($_POST['email']) && strlen($_POST['email']) > 1) { $action = "Getting Contact By Email Address"; try { // check to see if a contact with the email addess already exists in the account $response = $cc->getContactByEmail(ACCESS_TOKEN, $_POST['email']); // create a new contact if one does not exist if (empty($response->results)) { $action = "Creating Contact"; $contact = new Contact(); $contact->addEmail($_POST['email']); $contact->addList($_POST['list']); $contact->first_name = $_POST['first_name']; $contact->last_name = $_POST['last_name']; /* * The third parameter of addContact defaults to false, but if this were set to true it would tell Constant * Contact that this action is being performed by the contact themselves, and gives the ability to * opt contacts back in and trigger Welcome/Change-of-interest emails. * * See: http://developer.constantcontact.com/docs/contacts-api/contacts-index.html#opt_in */ $returnContact = $cc->addContact(ACCESS_TOKEN, $contact, true); // update the existing contact if address already existed } else { $action = "Updating Contact"; $contact = $response->results[0]; $contact->addList($_POST['list']); $contact->first_name = $_POST['first_name']; $contact->last_name = $_POST['last_name']; /* * The third parameter of updateContact defaults to false, but if this were set to true it would tell * Constant Contact that this action is being performed by the contact themselves, and gives the ability to * opt contacts back in and trigger Welcome/Change-of-interest emails. * * See: http://developer.constantcontact.com/docs/contacts-api/contacts-index.html#opt_in */ $returnContact = $cc->updateContact(ACCESS_TOKEN, $contact, true); } // catch any exceptions thrown during the process and print the errors to screen } catch (CtctException $ex) { echo 'Error ' . $action . ''; echo '
';
        print_r($ex->getErrors());
        echo '
'; die(); } } ?>

Join Our Mailing List!

Join thousands of others in our mailing list.

<form class="form-horizontal" name="submitContact" id="submitContact" method="POST" action="addOrUpdateContact.php"> //this is the issue that pops up. 
    <div class="control-group">
        <label class="control-label" for="email">Email</label>

        <div class="controls">
            <input type="email" id="email" name="email" placeholder="Email Address">
        </div>
    </div>
    <div class="control-group">
        <label class="control-label" for="first_name">First Name</label>

        <div class="controls">
            <input type="text" id="first_name" name="first_name" placeholder="First Name">
        </div>
    </div>
    <div class="control-group">
        <label class="control-label" for="last_name">Last Name</label>

        <div class="controls">
            <input type="text" id="last_name" name="last_name" placeholder="Last Name">
        </div>
    </div>
   
    <div class="control-group">
        <label class="control-label">
            <div class="controls">
                <input type="submit" value="Submit" class="btn btn-primary"/>
            </div>
    </div>
</form>
<?php if (isset($returnContact)) { echo '
';
    print_r($returnContact);
    echo '
'; } ?>
			</div> <!-- end #et-contact -->

		</article> <!-- .entry -->
<?php if ( ! $fullwidth ) get_sidebar(); ?>
<?php get_footer(); ?>[/php]

After hitting submit I get a screen that says no page exists… which I understand as that page does not exist…
This is where I got the code to use.

should I call the same page that users entered their data on? How do I make this work?

Sponsor our Newsletter | Privacy Policy | Terms of Service