V
V
Viktor Petrov2021-04-01 19:43:28
PHP
Viktor Petrov, 2021-04-01 19:43:28

How to set up php integration with checkbox?

There is integration with crm that works as it should, but when a client selects several colors of a product on the site, only one comes to crm, help me, I can’t figure out how to make all the colors that the client chose come to crm I don’t understand
PHP very well :(

<div class="modal-checkbox" >
                <label><input type="checkbox" name="selectcolor" value="Черный">Черный</label></br>
                <label><input type="checkbox" name="selectcolor" value="Белый">Белый</label></br>
                <label><input type="checkbox" name="selectcolor" value="Красный">Красный</label></br>
              </div>

<?
$name = $_REQUEST['name'];
$phone = $_REQUEST['phone'];
$selectsize = $_REQUEST['selectsize'];
$nameprod = $_REQUEST['nameprod'];
$selectcolor = $_REQUEST['selectcolor'];
if($selectsize!=='Выберите размер'){
$products = array( 
array('id'=>'id_1','name'=>'товар','size'=>'S','color'=>'Черный'),
array('id'=>'id_2','name'=>'товар','size'=>'M','color'=>'Черный'),
array('id'=>'id_3','name'=>'товар,'size'=>'L','color'=>'Черный'),
array('id'=>'id_4','name'=>'товар','size'=>'XL','color'=>'Черный'),
array('id'=>'id_5','name'=>'товар,'size'=>'S','color'=>'Белый'),
array('id'=>'id_6','name'=>'товар','size'=>'M','color'=>'Белый'),
array('id'=>'id_7','name'=>'товар','size'=>'L','color'=>'Белый'),
array('id'=>'id_8','name'=>'товар','size'=>'XL','color'=>'Белый'),
array('id'=>'id_9','name'=>'товар','size'=>'S','color'=>'Красный'),
array('id'=>'id_10','name'=>'товар','size'=>'M','color'=>'Красный'),
array('id'=>'id_11','name'=>'товар,'size'=>'L','color'=>'Красный'),
array('id'=>'id_12','name'=>'товар','size'=>'XL','color'=>'Красный'),
);
foreach($products as $value){
  if($value['size']==$selectsize and $value['name']==$nameprod and $value['color']==$selectcolor){
    $idprod = $value['id'];
  }
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question