I am integrating cc into a contact form.
Using cc_class.php I was able to successfully create a new contact.
How do I redirect to a thank you page after completing the data transfer?
Sending the data as XML already outputs a header.
Sending another header for redirection isn't permitted.
Thank you Michael
Hello,
The way that our cc_class.php file works is that once you call the addSubscriber function, it will return a success or fail code to you. What you would want to do is have an if statement that goes:
If you have any questions please let me know.
Regards,
This is my code. I get an error that the heading has already been sent.
include($_SERVER['DOCUMENT_ROOT'].'/application/library/cc_class.php');
$ccContactOBJ = new CC_Contact();
$ccListOBJ = new CC_List();
$contactXML =
'
<entry xmlns="http://www.w3.org/2005/Atom">
<title type="text"> </title>
<updated>2008-07-23T14:21:06.407Z</updated>
<author></author>
<id>data:,none</id>
<summary type="text">Contact</summary>
<content type="application/vnd.ctct+xml">
<Contact xmlns="http://ws.constantcontact.com/ns/1.0/">
<EmailAddress>'.$email.'</EmailAddress>
<OptInSource>ACTION_BY_CONTACT</OptInSource>
<ContactLists>
<ContactList id="http://api.constantcontact.com/ws/customers/asmithinvt/lists/1" />
</ContactLists>
</Contact>
</content>
</entry>
';
if (!$ccContactOBJ->addSubscriber($contactXML)) {
//nothing
}
else {
header("location: ".HTTPABSOLUTEPATH."index.php?go=thankyou");
}
Hello,
You normally get that error if you have already sent the header in your file. Our cc_class file does not use the header function at all, so it would have to be somewhere already in another piece of your code.
If you want, you can send us the entire code here, we can take a look to see if we can get it running.
Regards,
I figured it out. I was getting the error even if I only included the cc_class.php file.
Erasing the file, creating a new one and pasting the contents off cc_class.php into it fixed it.
Not sure what the exact problem was, but I'm assuming there was type of character set/file format issue.
The holidays have come and gone. For many seasonal businesses, this means the rush of shoppers has decreased as well. Instead of turning off the lights and waiting for spring, make your email marketi...
See Article