-3

I have a PHP sendmail script that sends to an email address from user input:

$to = $_POST['email'];

How do I add an actual email address to go alongside that - for example:

$to = $_POST['email', 'foo@bar.com'];

Thanks

user-a5567ffg
  • 227
  • 1
  • 3
  • 13
  • 1
    `$to = array($_POST['email'],'foo@bar.com');` – Thomas Rollet Jan 07 '16 at 16:15
  • I'm hoping the above comment is what you were looking for. But I never would have guessed that was what you were asking if it is. – developerwjk Jan 07 '16 at 16:18
  • I think you should transcribe that into an answer @ThomasRollet with a bit of *"oomf!"* too ;-) – Funk Forty Niner Jan 07 '16 at 16:18
  • Seeing your comment below; post more/full code including how you're sending mail, and something may be failing you somewhere. Form method, no name attributes etc. etc. error reporting will tell you that http://php.net/manual/en/function.error-reporting.php - that's IF you're paying attention to comments here. – Funk Forty Niner Jan 07 '16 at 17:17

1 Answers1

2

You can do this and using an array:

$to = array($_POST['email'],'foo@bar.com');
Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141
Thomas Rollet
  • 1,573
  • 4
  • 19
  • 33