JSHINER Posted September 3, 2008 Share Posted September 3, 2008 I have this: if(isset($_POST['send'])) { echo str_replace("###", ", ", $_POST['to']), '<br>'; echo $_POST['subject'], '<br>'; echo $_POST['message'], '<br>'; echo $_POST['user_id']; } Which works fine. But the $_POST['to'] comes over as "[email protected], [email protected], [email protected]" - how can I turn that into an array and have it run a foreach so it displays the subject, message, user_id individually for each email sent. So would echo: [email protected] Subject Message UserId [email protected] Subject Message UserId etc... Link to comment https://forums.phpfreaks.com/topic/122584-solved-turning-something-into-an-array/ Share on other sites More sharing options...
discomatt Posted September 3, 2008 Share Posted September 3, 2008 $_POST['send'] = TRUE; $_POST['to'] = '[email protected]###[email protected]'; $_POST['subject'] = 'subject'; $_POST['message'] = 'message'; $_POST['user_id'] = 'userid'; if(isset($_POST['send'])) foreach( explode('###', $_POST['to']) as $email ) { echo $email. '<br>'; echo $_POST['subject']. '<br>'; echo $_POST['message']. '<br>'; echo $_POST['user_id']. '<br><br>'; } Link to comment https://forums.phpfreaks.com/topic/122584-solved-turning-something-into-an-array/#findComment-632946 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.