mercredi 24 juin 2015

How to send label fields which are previously checked via checkbox through php

I have a table with one checkbox for three fields. And I need to send data of this fields to my email. Here is what I have. Other checkboxes work properly. Also I have inputs with name and email above. And I create an errors for them but delete it from php code for specific understanding

And here is php code:

<?php
if (isset($_POST["submit"])) {
    $forms = $_GET['participation'];
    $subject = 'Some subject here';
    $from = 'Demo Contact Form'; 
    $to = 'email@energy-knutd.netau.net'; 


    $form = join(", ", $_REQUEST["participation"]);
    $body ="Form: $form";

    if (!$errName && !$errEmail) {
        if (mail ($to, $subject, $body, $from)) {
            $result="<div class='alert alert-success'>Thank You $name! I will be in touch</div>";
        } else {
            $result='<div class="alert alert-danger">Sorry there was an error sending your message. Please try again later.</div>';
        }
    }
?>




Aucun commentaire:

Enregistrer un commentaire