I always struggle with loops and in particular associative arrays is still new to me and trying to get past it. I am trying to setup a form to insert multiple emails at once into our sendy email list through the use of their api. I am successful in inserting the first email into the list, but the remaining emails get lost. Your help is greatly appreciated!
PHP Below:
<?php
require('sendyLibrary.php');
$sendy = new SendyLibrary('3');
$email = $_POST['email'];
//$textareaContents = str_replace("", ',', $email);
$multipleEmails = explode("", $email);
foreach($multipleEmails as $key => $finalEmail) {
$sendy->subscribe(array(
'email' => $finalEmail
));
echo 'email: ' . $finalEmail .'<br/>';
}?>
Response from POST method:
email sam@testing.com samg@testing.com samgo@testing.com samgol@testing.com samgolu@testing.com
Source from POST method:
email=sam%40testing.com%0D%0Asamg%40testing.com%0D%0Asamgo%40testing.com%0D%0Asamgol%40testing.com%0D%0Asamgolu%40testing.com
Thank you for your help!