Checkbox and Phpmailer

Asked

Viewed 304 times

1

Hello, everybody!

I am unable to send checkbox values through Phpmailer. Could someone give me a hint?

$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>

1 answer

1


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

Change:

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

for:

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

Example - phpfiddle

  • and when the checkbox has different Ames as it could do?

  • @allanaraujo as well?

  • this is my question would you like to answer it ? http://answall.com/questions/178790/como-checkbox-com-names-diferentes-para-o-mysql

  • I have an order screen with an input text and two checkbox with different Names and two other input text to place the quantities , and also with different Names to send them to mysql ,but I do not know how to use more than one implode to insert into the database .

Browser other questions tagged

You are not signed in. Login or sign up in order to post.