Dynamic checkbox that imports columns from tables in mysql

1

I use an mpdf library to generate pdf querying my database. I have to add columns dynamically in this pdf using checkbox. Each checked box adds a specific column in my pdf and unchecks is to disappear. I would like to know how I do this ..preference using javascript.

<?php
require_once './conexao.php';

$pdo = Conexao::getInstance();
$sql = 'SELECT * FROM eventos';
$stm = $pdo->prepare($sql);
$stm->execute();
$dados = $stm->fetchAll(PDO::FETCH_OBJ);
?>

<html>
    <head>
        <title>Eventos Sinpro-df</title>
    </head>
    <body>



        <table border="0" cellspacing="0" cellpadding="0" style="width:100%; margin:2px ; border-collapse">
            <tr> <th> <a href="http://www.sinprodf.org.br/" target="_Blank" title="Clique aqui e visite nossa página"><img src="./images.jpg" height="200 px" width="423px"/></a> </th></tr>

        </table>


        Escolha seu evento:<br>
        <select name="eventos" id="eventos">
            <option value=""> </option>


            <?php
            foreach ($dados as $value) {

                echo "<option value='$value->id'>$value->nome</option>";
            }
            ?>

        </select>

        <input type="button" value="enviar" onclick="javascript: gerar();" />
        <input type="reset" value="Cencelar"/>

    </body>




<script type="text/javascript">



    function gerar() {

        var evento = document.getElementById("eventos").value;
        location.href = "./teste.php?id=" + evento;


    }


</script>



<br/><br/>
        <input type="checkbox" value="Telefone"/> Creche<br/>
        <input type="checkbox" value="Celular"/>Celular<br/>
        <input type="checkbox" value="Email"/>Email<br/>
        <input type="checkbox" value="Creche"/>Creche<br/>
        <input type="checkbox" value="Necessidade"/>Necessidade<br/>
<br/>


</html>

part of my code. This is a page that selects tables and generates in pdf using mpdf and already has the checkboxes (chekbox) that I want to use to get the columns of the bank and leave in the PDF dynamically ...

    
asked by anonymous 28.06.2016 / 17:09

0 answers