I am having some difficulty adding a contact using the php wrapper. I am not a professional programmer and am very new to this. We currently have formmail.php up and running and it seems to be pretty stable. I wanted to manipulate some of the hidden fields in our forms as well as determine whether or not the person filling out the form wished to be added to the mailing list before submitting data to formmail. I created a little file to do that for me. Both forms on the website submit data to this script called "submit.php". This works as long as the "mailing_list" checkbox is not checked. Otherwise I get the error "This feed contains a DTD (Document Type Definition). DTDs are used to define a structure of a webpage. Internet Explorer does not support DTDs in feeds." <?php
//Manipulate hidden fields for payment
if (isset($_POST["Registration_Selection"]) && $_POST["Registration_Selection"] == "Session 1 --- June 18 to June 23 2012 --- $325.00")
$_POST["Tuition"] = "325";
if (isset($_POST["Registration_Selection"]) && $_POST["Registration_Selection"] == "Session 2 --- June 25 to June 30 2012 --- $325.00")
$_POST["Tuition"] = "325";
if (isset($_POST["Registration_Selection"]) && $_POST["Registration_Selection"] == "Both Sessions --- June 18 to June 30 2012 --- $580.00")
$_POST["Tuition"] = "580";
$_POST["Process_Fee"] = "10";
//
//Check to see if they want to join the mailing list and if they do include the script to add the email address
//
if (isset($_POST["Mailing_List"]) && $_POST["Mailing_List"] == "Yes")
include('addcontact.php');
//
// Now include FormMail to do all the rest of the work...
//
include('formmail.php');
?> Here is the file "addcontact.php" that I am calling in the event that the checkbox is checked. I found this in another post and I am just trying to get this bit working before trying to add the rest of the contact info to the contact object from the POST array. I have place the php wrapper I downloaded into a folder called "ConstantConatct" and have removed my login info and key from the following. <?php
include_once('ConstantContact/ConstantContact.php');
// Connecting to your account
$ConstantContact = new ConstantContact("basic", "REMOVED", "REMOVED", "REMOVED");
// Get potential contact lists
$lists = $ConstantContact->getLists();
// Lists are returned in multidimentional arrays 0 being the list, and 1 being the next50
// Email address here is used for testing purposes
// NOTE: This email address will be added to your account if you execute this script,
// you should send this to do-not-mail after your testing
$emailAddress = "testemail@test.com";
// Search for our new Email address
$search = $ConstantContact->searchContactsByEmail($emailAddress);
// If the search didnt return a contact object
if($search == false)
{
// Create a new Contact Object to store data into
$contactObj = new Contact();
// Adding multiple lists to this new Contact Object
$contactObj->lists = array($lists['lists'][0]->id, $lists['lists'][1]->id);
// Set the email address
$contactObj->emailAddress = $emailAddress;
// Create the Contact and DONE
$Contact = $ConstantContact->addContact($contactObj);
} // Otherwise we update our existing
else
{
// Gather data from our previous search and store it into a data type
$contactObj = $ConstantContact->getContactDetails($search[0]);
// We need to get the old list and add a new list to it as
// this request requires a PUT and will remove the lists
// as they are stored in an array
array_push($contactObj->lists, $lists['lists'][3]->id );
// Update the contact and DONE
$UpdateContact = $ConstantContact->updateContact($contactObj);
}
?> Any help would be greatly appreciated.
... View more