Send select to print with php

Asked

Viewed 174 times

0

I need to dynamically create a table with "n" lines and then send this table to print, but not succeeding, the construction of the table is like this:

    // laço para buscar e-mail e efetuar envio
foreach($checkboxes as $id) {

    // deletando registro do candidato
    mysql_select_db($database_conCurriculo, $conCurriculo);
    $query_rsRegistro = "SELECT * FROM candidato WHERE id_candidato = $id ";
    $rsRegistro = mysql_query($query_rsRegistro, $conCurriculo) or die(mysql_error());
    $row_rsRegistro = mysql_fetch_assoc($rsRegistro);
    $totalRows_rsRegistro = mysql_num_rows($rsRegistro);
    $status = $rsRegistro;

   $impressao =  " <table width='100%' border='1'>
        <tbody>
          <tr class='new-record-row' style='display: none;' data-new-row='false'>
            <td colspan='7' data-column-name='sm_multi_delete_column'></td>
          </tr>
          <tr class='pg-row' style=''>
            <td class='data-operation' >{$row_rsRegistro['nome']}</td>
            <td class='data-operation' data-column-name='edit' >implode('-', array_reverse(explode('-', {$row_rsRegistro['dt_nascimento']})));</i></td>
            <td data-column-name='ID' >implode('-', array_reverse(explode('-',{$row_rsRegistro['dt_atualizacao']})));></td>
            <td data-column-name='ID' >{$row_rsRegistro['endereco']}; ?></td>
            <td data-column-name='Nome'>{$row_rsRegistro['id_municipio']}; ?>
            <td colspan='2' style='' data-column-name='DataCadastro'>{$row_rsRegistro['id_uf']}; ?></td>
          </tr>
        </tbody>
    </table>";


} // fim do foreach

How can I mount it and send it to print?

  • How do you want to print? The table is displayed in HTML and printed? You want to generate a PDF straight from PHP?

  • What I’m intending to do is generate the html and send it to print, like a listagen.

1 answer

1


I use while to generate select dynamically, hopefully the example below will help you:

<?php
$select = pg_query($conexao, $sql->menu_logado($entidade));

echo "<select name=\"codseg\" onChange=\"document.forms['segmentos'].submit();\">";

echo "<option>SELECIONE</option>";

echo "<option value=''>TODOS</option>";

while ($segmento = pg_fetch_array($select)) {

    $cod = $segmento['segcodseg'];

    $descricao = str_replace("/", " / ", $segmento['segdesseg']);

    $c = '';

    if ($selecionado == $cod) {

        $c = ' SELECTED';

    }

    echo "<option value='".$cod."' $c>".$descricao."</option>";

}

echo "</select>";
  • Thanks for the @Gustavo Emmel script

Browser other questions tagged

You are not signed in. Login or sign up in order to post.