How Can I Customize My Thank You Page With My Subscriber's Data?

With Imnica Mail, you can collect different data from your subscribers via your opt-in form with the help of custom fields. With some basic PHP knowhow, you can then use this data on your thank you page to customize the page.

Here's an example form with some custom fields:
http://www.imnicamail.com/xmlsignup.html

When someone signs up via that form, they are redirected to a custom Thank You page (this can be set in your List Settings)

To customize your thank you page with the data, first save it with a .php extension (example: thankyou.php). You can use a program like Notepad (on Windows) or TextWrangler (on Mac) for this purpose.

Now, to customize the page and insert data we've just collected, use this code:

<?php

$ImnicaMailXml = simplexml_load_string(rawurldecode($_GET['XMLReturn']));

$SubscriberID = $ImnicaMailXml->Subscriber->SubscriberID;
$EmailAddress = $ImnicaMailXml->Subscriber->EmailAddress;
$FirstName = $ImnicaMailXml->Subscriber->CustomField3600;
$LastName = $ImnicaMailXml->Subscriber->CustomField3601;
?>

Note that $EmailAddress is a variable, which stores data from the form. Similarly, $LastName is a variable that stores data from CustomField3601 in the form and so on. Please refer to your form's HTML code to know the exact field name you would need to use.

Finally, you can display the data in the variables like this:

<?php

echo "Subcriber ID: {$SubscriberID}<br>\n";
echo "Email Address: {$EmailAddress}<br>\n";
echo "First Name: {$FirstName}<br>\n";
echo "Last Name: {$LastName}<br>\n";

?>

 

So, you could use this data to address the subscriber with their first name by inserting the code like this:

Hi <?php echo $FirstName; ?>,

Thank you for signing up to MyTestList. An confirmation email has been sent to <?php echo $EmailAddress; ?>. Please click the link to confirm your subscription.

 

Save your Thank You page as a PHP file (.php) and upload it to your server. Make sure the custom redirect in your list settings point to this PHP file and you're done!

Have more questions? Submit a request

2 Comments

  • 0
    Avatar
    Steve

    $ImnicaMailXml = simplexml_load_string(rawurldecode($_GET['XMLReturn']));

    does NOT work on my server - it's always resulting in an error message. Reason for that: the escaped double quotes in the line

    <?xml version=\"1.0\" encoding=\"utf-8\"?>

    I got rid of them with stripcslashes

    $ImnicaMailXml = simplexml_load_string(stripcslashes(rawurldecode($_GET['XMLReturn'])));

    but that might be 'dirty' coding....

    So can you maybe have a look into this and let the community know if this is the official answer to the problem, or if you'd prefer us to take a different approach.

     

    Thanks a lot!

  • 0
    Avatar
    Sagar Mehta

    Hi Steve,

    Right now, the only way around the issue is to use stripcslashes in the way you've described.

Please sign in to leave a comment.
Powered by Zendesk