Hello All,

I'm attempting submit an HTML form using PHP and I'm getting these 2 errors - not sure what is wrong.

Warning: implode() expects at most 2 parameters, 6 given in C:\xampp\htdocs\transferform\send.php on line 67

Warning: mail() expects at least 3 parameters, 1 given in C:\xampp\htdocs\transferform\send.php on line 67
Thank you, your request has been sent!

My PHP code:

<?php
sleep(2);
//Sanitize incoming data and store in variable

$stockNumber = trim(stripslashes(htmlspecialchars ($_POST['stockNumber'])));
$serialNumber = trim(stripslashes(htmlspecialchars ($_POST['serialNumber'])));
$description = trim(stripslashes(htmlspecialchars ($_POST['description'])));
$requestedBy = trim(stripslashes(htmlspecialchars ($_POST['requestedBy'])));
$requestedDate = trim(stripslashes(htmlspecialchars ($_POST['requestedDate'])));
$customerInfo = trim(stripslashes(htmlspecialchars ($_POST['customerInfo'])));

// Array for the R_emails option from form
$R_emails = array(
'R_boston' => 'boston@test.com.com',
'R_columbia' => 'columbia@test.com',
'R_raleigh' => 'raleigh@emailhere.com',
'R_orlando' => 'test@email.com',
'R_topeko' => 'columbia@emailhere.com',
'R_toledo' => 'raleigh@emailhere.com',
'R_cinncinatti' => 'test@email.com',
'R_dallas' => 'columbia@emailhere.com',
'R_buffalo' => 'raleigh@emailhere.com',
'R_kansas' => 'test@email.com',
'R_fairfax' => 'columbia@emailhere.com',
'R_la' => 'raleigh@emailhere.com',
);

// get receiving email and turn in the the R_email variable
$R_email = $R_emails[ $_POST['R_branch'] ];

// Array for the S_emails option from form
$S_emails = array(
'S_boston' => 'boston@test.com',
'S_columbia' => 'columbia@test.com',
'S_raleigh' => 'raleigh@emailhere.com',
'S_orlando' => 'test@email.com',
'S_topeko' => 'columbia@emailhere.com',
'S_toledo' => 'raleigh@emailhere.com',
'S_cinncinatti' => 'test@email.com',
'S_dallas' => 'columbia@emailhere.com',
'S_buffalo' => 'raleigh@emailhere.com',
'S_kansas' => 'test@email.com',
'S_fairfax' => 'columbia@emailhere.com',
'S_la' => 'raleigh@emailhere.com',
);

// get receiving email and turn in the the S_email variable
$S_email = $S_emails[ $_POST['S_branch'] ];

//Prepare information from form to be sent
$to = 'user@example.com';
$from = 'use2r@example.com';
$headers = 'MIME-VERSION: 1.0' . '\n';
$headers .= 'From: $from' . '\n';
$subject = 'Online Order Request';
$body = 'Stock Number: ' .$stockNumber . PHP_EOL;
$body .= 'Serial Number: ' .$serialNumber . PHP_EOL;
$body .= 'Description: ' .$description . PHP_EOL;
$body .= 'Requested By: ' .$requestedBy . PHP_EOL;
$body .= 'Requested Date: ' .$requestedDate . PHP_EOL;
$body .= 'Customer Info: ' .$customerInfo . PHP_EOL;

// Form data was successful so we will now send admin email and return message to the user
$success = mail( implode(',', array( $R_email, $S_email ), $subject, $body, $headers , '-f user@example.com') );
echo 'Thank you, your request has been sent!';

?>