PHP_ Display HTML information on the page SELECT

0

I need a help in PHP ... I would like that as soon as the user clicked on a SELECT option, it would be shown on the same page, below the form.

Could you give me an idea how to do it?

EXAMPLE:

  Value 1   Value 2   Value 3

As soon as the user chooses a value to appear on the HTML page below and if he continues to choose other values as soon as he clicks the continue button displaying one underneath the other in HTML ...

    
asked by anonymous 13.10.2016 / 18:21

1 answer

0

Below are two options on how to do with jquery.

$('select').change(function() {
  // opção 1
  if ($(this).val()) $('div.op1').append($(this).val() + '<br>');

  // opção 2
  if ($(this).val()) $('div.op2').append($('#html'+$(this).val()).html());
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><select><optionvalue="">Selecione...</option>
  <option value="1">Valor 1</option>
  <option value="2">Valor 2</option>
  <option value="3">Valor 3</option>
</select>
<hr>
<div class="op1"></div>
<hr>
<div style="display:none">
  <div id="html1">Conteúdo HTML 1<br></div>
  <div id="html2">Conteúdo HTML 2<br></div>
  <div id="html3">Conteúdo HTML 3<br></div>
</div>
<div class="op2"></div>
    
14.10.2016 / 16:13