Jessica Mather Jessica Mather - 1 year ago 49
PHP Question

How can I get the values of a multiselect into an echo statement?

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>
<p>Another Sentence". [I want to put an array here]."</p>

Answer Source

Something like this? (Untested)

$message = "
            <p>Sentence" .$_POST['somevarriable']. "</p>
            <p>Another Sentence "

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

    $message .= "


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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download