V
V
Vladimir Yurkov2020-05-21 19:01:49
PHP
Vladimir Yurkov, 2020-05-21 19:01:49

How to submit a selection of multiple checkboxes?

Hello everyone!!! I have a form with multiple choice of checkboxes, the form looks like this

<div class="col-md-4 col-sm-4">
                               <div class="select-box">
                                   <input type="checkbox" id="option3-1" name="step[]" value="Пластик">
                                   <label for="option3-1">Пластик</label>
                                   <img src="img/step3-1.jpg" alt="">
                               </div>
                           </div>
                           <div class="col-md-4 col-sm-4">
                               <div class="select-box">
                                   <input type="checkbox" id="option3-2" name="step[]" value="Акрил">
                                   <label for="option3-2">Акрил</label>
                                   <img src="img/step3-2.jpg" alt="">
                               </div>
                           </div>
                           <div class="col-md-4 col-sm-4">
                               <div class="select-box">
                                   <input type="checkbox" id="option3-3" name="step[]" value="Массив">
                                   <label for="option3-3">Массив</label>
                                   <img src="img/step3-3.jpg" alt="">
                               </div>
                           </div>
                           <div class="col-md-4 col-sm-4">
                               <div class="select-box">
                                   <input type="checkbox" id="option3-4" name="step[]" value="ДСП">
                                   <label for="option3-4">ДСП</label>
                                   <img src="img/step3-4.jpg" alt="">
                               </div>
                           </div>
                           <div class="col-md-4 col-sm-4">
                               <div class="select-box">
                                   <input type="checkbox" id="option3-5" name="step[]" value="МДФ Ромочный">
                                   <label for="option3-5">МДФ Ромочный</label>
                                   <img src="img/step3-5.jpg" alt="">
                               </div>
                           </div>
                           <div class="col-md-4 col-sm-4">
                               <div class="select-box">
                                   <input type="checkbox" id="option3-6" name="step[]" value="МДФ Крашеный">
                                   <label for="option3-6">МДФ Крашеный</label>
                                   <img src="img/step3-6.jpg" alt="">
                               </div>
                           </div>


This is what the PHP engine looks like

Select kitchen layout: ".$_POST['level1']."
Height: ".$_POST['level21']."
Width: ".$_POST['level22']."
Length: ".$_POST['level23']."
Select facade material: ".$_POST['step']."
Appliances in the kitchen: ".$_POST['step1']."

Name: ".$_POST['name']."
Phone: ".$_POST['phone']."

but I receive only one checkbox, tell me how to make all the selected ones come, I don’t understand a little in PHP, could you tell me what to add

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
AUser0, 2020-05-21
@AUser0

Each checkbox must have a unique name. You can even name='step[1]'.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question