0

I am trying to get the values of a multiselect to be listed into a php email form. The variable is name="variable[] "

I don't know how to go about it, so any advice would be awesome

  $message = "<html><head><title></title></head>
        <body>
            <p>Sentence".$_POST['somevarriable']."</p>
            <p>Another Sentence". [I want to put an array here]."</p>
        </body>
        </html>";
Jessica Mather
  • 133
  • 1
  • 11

1 Answers1

1

Something like this? (Untested)

$message = "
    <html>
        <head><title></title></head>
        <body>
            <p>Sentence" .$_POST['somevarriable']. "</p>
            <p>Another Sentence "
    ;

    foreach ($_POST['variable'] as $selectedOption){
        $message .= $selectedOption . ' ';
    }

    $message .= "
            </p>
        </body>
    </html>
    ";

Reference:

How to get multiple selected values of select box in php?

Community
  • 1
  • 1
cssyphus
  • 37,875
  • 18
  • 96
  • 111