mercredi 3 novembre 2021

How to send multi checkbox input value in php reusable forms?

I am using the "reusableforms.com" PHP form script. The form is working well. But I got an error on multi-input checkbox values.

How can I get the multi-input checkbox values?

HTML Code:

<div class="form-box">
    <label>Choose which of the following are most important to you:</label>
    <div class="multi-select">
        <div class="custom-select">
            <input type="checkbox" id="hight-rating" value="High Rating" name="important" hidden>
            <label for="hight-rating">High Rating</label>
        </div>
        <div class="custom-select">
            <input type="checkbox" id="mobile-phone-app" value="Mobile phone app" name="important" hidden>
            <label for="mobile-phone-app">Mobile phone app</label>
        </div>
        <div class="custom-select">
            <input type="checkbox" id="vendor-management" value="Vendor management" name="important" hidden>
            <label for="vendor-management">Vendor management</label>
        </div>
    </div>
</div> 

handler.php

<?php
    ini_set('display_errors', 1);
    ini_set('display_startup_errors', 1);
    error_reporting(E_ALL);

    require_once './vendor/autoload.php';
    
    use FormGuide\Handlx\FormHandler;    
    
    $pp = new FormHandler(); 
    
    $validator = $pp->getValidator();
    $validator->fields(['name','email', 'phone', 'address', 'property', 'following', 'units', 'date'])->areRequired()->maxLength(50);
    $validator->field('important[]')->maxLength(5000);
    $validator->field('email')->isEmail();
    
    
    $pp->sendEmailTo('xxx@gmail.com'); // ← Your email here
    
    echo $pp->process($_POST);
?>

Thank you.




Aucun commentaire:

Enregistrer un commentaire