<选择多个>不使用PHP [重复]在html表单上工作

This question already has an answer here:

Okay, so I have a html form, and a using php for the server side validation to send the information from the form as an email. I cannot, for the life of me, get the form to send the items as an array.

Here's my html:

   <select multiple name="symptoms[]">
   <option value="ADHD">ADHD</option>
   <option value="Insomnia">Insomnia</option>
   <option value="Depression">Depression</option>
   <option value="PTSD">PTSD</option>
   <option value="Autism">Autism</option>
   <option value="Stress">Stress</option>
   <option value="Addiction">Addiction</option>
   <option value="Pain">Pain/Headaches</option>

Here's my php in which I think the problem lies:

// validation expected data exists

if(!isset($_POST['first_name']) ||

    !isset($_POST['last_name']) ||

    !isset($_POST['email']) ||

    !isset($_POST['telephone']) ||

    !isset($_POST['symptoms']) ||

    !isset($_POST['location']) ||

    !isset($_POST['comment'])) {

    died('We are sorry, but there appears to be a problem with the form you submitted.');       

}

$first_name = $_POST['first_name']; // required

$last_name = $_POST['last_name']; // required

$email_from = $_POST['email']; // required

$telephone = $_POST['telephone']; // not required

$symptoms = $_POST['symptoms']; // not required

$location = $_POST['location']; // not required

$comments = $_POST['comment']; // required

There is also this section of php, but I don't think the 'symptoms' area is a problem here...

function clean_string($string) {

  $bad = array("content-type","bcc:","to:","cc:","href");

  return str_replace($bad,"",$string);

}

$email_message .= "First Name: ".clean_string($first_name)."
";

$email_message .= "Last Name: ".clean_string($last_name)."
";

$email_message .= "Email: ".clean_string($email_from)."
";

$email_message .= "Telephone: ".clean_string($telephone)."
";

$email_message .= "Symptoms: ".clean_string($symptoms)."
";

$email_message .= "Location: ".clean_string($location)."
";

$email_message .= "Comment: ".clean_string($location)."
";

I have been trying to change the !isset all day and the $symptoms lines to get the 'symptoms' select multiple to show up on my email as an array. Right now it just says "array" in the email. I was thinking maybe the .clean-string should be something to do with array instead of string? I'm completely stuck, I've tried everything I can find, copied and pasted and tinkered and changed about 5 different sets of codes I found on stackoverflow...

</div>

If you echo (or concatenate, or some other method which will cast to string) an array, it will just say "Array", so you have to convert it to a string somehow. One method is to use implode, so you can display the array as a comma separated list:

$email_message .= "Symptoms: ".clean_string(implode(", ",$symptoms))."
";

http://php.net/implode

if you want to get fancy and make sure there is an " and" before the last item, you could do

$symptomString = implode(", ", $symptoms); 
$lastComma = strrpos($symptomString, ", ");
$symptomString = substr_replace($symptomString, "and", $lastComma, 2);