M
M
Michael_E2017-03-30 20:45:28
PHP
Michael_E, 2017-03-30 20:45:28

Concatenate form field values ​​into one string?

There is a form, from set of fieldset, with radio buttons.
You need to transfer the selected answers to Bitrix24 , in the "comment" field, separating them with a space.
From one field, information is transmitted like this:

<form action="rest.php" method="post>
  <input type="text" name="DATA[COMMENTS]" placeholder="Комментарий" >
  ...
</form>

$postData = array(
  'COMMENTS' => $leadData['COMMENTS'],
);

But what about such a thing?
<form>

  <fieldset id="question-1">
    <legend>Вопрос 1</legend>

    <input type="radio" name="size" id="size_1" value="one">
    <label for="size_1">Ответ 1</label>

    <input type="radio" name="size" id="size_2" value="two">
    <label for="size_2">Ответ 2</label>

    <input type="radio" name="size" id="size_3" value="three">
    <label for="size_3">Ответ 3</label>
    
    <input type="button" id="button-1" value="Далее">
  </fieldset>
  
  <fieldset id="question-2">
    <legend>Вопрос 2</legend>

    <input type="radio" name="size2" id="size_4" value="four">
    <label for="size_4">Ответ 4</label>

    <input type="radio" name="size2" id="size_5" value="five">
    <label for="size_5">Ответ 5</label>

    <input type="radio" name="size2" id="size_6" value="six">
    <label for="size_6">Ответ 6</label>
    
    <input type="button" id="button-2" value="Далее">
  </fieldset>

</form>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
ThunderCat, 2017-03-31
@ThunderCat

Specify the Bitrix tag, otherwise not everyone here understands varieties ... mashed potatoes.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question