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:xampphtdocstransferformsend.php on line 67
Warning: mail() expects at least 3 parameters, 1 given in C:xampphtdocstransferformsend.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 ($
$description = trim(stripslashes(htmlspecialchars ($_POST[‘description’])));
$requestedBy = trim(stripslashes(htmlspecialchars ($
$requestedDate = trim(stripslashes(htmlspecialchars ($_POST[‘requestedDate’])));
$customerInfo = trim(stripslashes(htmlspecialchars ($
// Array for the R_emails option from form
$R_emails = array(
‘R_boston’ => ‘
‘R_columbia’ => ‘
‘R_raleigh’ => ‘
‘R_orlando’ => ‘
‘R_topeko’ => ‘
‘R_toledo’ => ‘
‘R_cinncinatti’ => ‘
‘R_dallas’ => ‘
‘R_buffalo’ => ‘
‘R_kansas’ => ‘
‘R_fairfax’ => ‘
‘R_la’ => ‘
);
// 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’ => ‘
‘S_columbia’ => ‘
‘S_raleigh’ => ‘
‘S_orlando’ => ‘
‘S_topeko’ => ‘
‘S_toledo’ => ‘
‘S_cinncinatti’ => ‘
‘S_dallas’ => ‘
‘S_buffalo’ => ‘
‘S_kansas’ => ‘
‘S_fairfax’ => ‘
‘S_la’ => ‘
);
// 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 = ‘
$from = ‘
$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 [email][email protected]
echo ‘Thank you, your request has been sent!’;
?>