简体   繁体   中英

Multiple select option form sends 'array' email

I am having a bit of a problem, the form i created have to have multiple options to select different car models, now the problem is I can not see what the client selected because the email says "vehicle make: array"

Please help me to display the list of cars they have selected in the email I received.

EDIT: Please note I'm noob at code, and need some assistance in fixing this. I didn't code this!

if(isset($_POST{'name'}) && isset($_POST{'email'})&& isset($_POST{'phone'}) )

                                        {$name=$_POST['name'];
                                        $surname=$_POST['surname'];
                                        $phone= $_POST['phone'];
                                        $email= $_POST['email'];
                                        $vehiclemake=$_POST['vehiclemake'];
                                        $vehiclemodel=$_POST['vehiclemodel'];
                                        $yearmodel=$_POST['yearmodel'];
                                        $logo=$_POST['logo'];
                                        $message=$_POST['message'];
                                        if (!empty($name) 
                                        && !empty($email)  
                                        && !empty($phone) 
                                        )
                                        {$to='';
                                        $subject='Contact Us form from cover-worx.co.za website';
                                        $body='Name: ' . $name . "\n\n"
                                        .'Surname: ' .$surname ."\n\n" 
                                        .'Phone number: ' .$phone ."\n\n"
                                        .'Vehicle Make: ' .$vehiclemake ."\n\n"
                                        .'Vehicle Model: ' .$vehiclemodel ."\n\n"
                                        .'Year Model: ' .$yearmodel ."\n\n"
                                        .'Email: ' .$email ."\n\n"
                                        .'Logo Required Yes/No: ' .$logo ."\n\n"
                                        . 'Message:' . $message; 
                                        $headers='From:' .$email;

                                            if ( @mail($to, $subject, $body, $headers)){
                                                echo '<p color="#FF0000">Thanks for contacting us...</p>';} 
                                                else { echo '<p color="#FF0000">Problem with the server, try again later</p>';}}
                                                else{echo '<p color="#FF0000">All fields are required.</p>';}}
                                        ?>



<p class="span4 field"><span class="wpcf7-form-control-wrap your-phone"><select multiple="multiple" name="vehiclemake[]">

                                                        <option value="SelectModel">
                                                            Select Model
                                                        </option>
                                                        <option value="ChevroletCaptiva">
                                                            Chevrolet Captiva
                                                        </option>
                                                        <option value="ChevroletCorsaUtility">
                                                            Chevrolet Corsa Utility
                                                        </option>

This is what the mail sends

Vehicle Make: Array

Vehicle Model:

Year Model: 2014

您可以使用implode(',', $array)加入一个数组,以逗号分隔的数组值列表。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM