Checkbox and PHPMailer

1

Hello, everyone!

I'm not able to send checkbox values through PHPMailer. Could someone give me a tip?

$precisa = implode(",", $_POST['precisa[]'] );

<label>
                    <p style="margin-right: 40px;">O QUE VOCÊ PRECISA?</p>
                    <label>
                        <input type="checkbox" class="check" name="precisa[]" value="Site"><font color="#ffe200">Site</font>
                        <input type="checkbox" class="check" name="precisa[]" value="App"><font color="#ffe200">App</font>
                        <input type="checkbox" class="check" name="precisa[]" value="Logomarca"><font color="#ffe200">Logomarca</font><br />
                        <input type="checkbox" class="check" name="precisa[]" value="Catálogo"><font color="#ffe200">Catálogo de produtos</font><br />

                        <input type="submit" class="button" value="Enviar contato" />
                    </label>
    
asked by anonymous 12.06.2015 / 22:15

1 answer

1

When a field of your form is an array (the attribute name needs brackets), when receiving it in php it is not necessary to use brackets in the name.

Change:

$precisa = implode(",", $_POST['precisa[]'] );

To:

$precisa = implode(",", $_POST['precisa'] );

Example - phpfiddle

    
12.06.2015 / 22:19