vanea Posted June 24, 2009 Share Posted June 24, 2009 hello. i'm newbie. please help me. I have a page(raport.php) which extract all data from MYSQL table named also "data". this page crate a html table to show all extracted fields raport.php <? include ("../conex.php"); include ("restrictie.php"); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title></title> </head> <style type="text/css"> table {font-size: 80%; font-family: Arial,Verdana,Helvetica,sans-serif; border: 1px thin #000000;} table.brul {font-family: Arial,Verdana,Helvetica,sans-serif; border: 0px thin #ccc;} td.brul {border: 0px #ccc;} td.aprob {border: 0px #ccc; font-size: 120%; } td.brul2 {font-size: 300%; border: 0px #ccc;} tr.brul {border: 0px #ccc;} td.inregi {border: 0px #ccc; font-style:italic;} font {font-size: 100%; font-family: Arial,Verdana,Helvetica,sans-serif;} font.man {font-size: 200%; font-family: Arial,Verdana,Helvetica,sans-serif; font-style: italic;} font.subsol {font-size: 75%; font-family: Arial,Verdana,Helvetica,sans-serif;} th {font-family: Arial,Verdana,Helvetica,sans-serif; border: 1px solid #000000; background-color: #eee} td {font-family: Arial,Verdana,Helvetica,sans-serif; border: 1px solid #000000;} </style> <body> <?php $ziua=date("d.m.Y"); $ora=date("H:i:s"); $result = mysql_query("SELECT * FROM data"); echo "<table class='brul' cellpadding='0' cellspacing='0' width='100%'> <tr> <td colspan='1' rowspan='2'></td> <td class='brul2'>Lista colaboratorilor</td> <td class='aprob'><center>APROB<br>Director adjunct<br>_______ A. Marinsescu<br>„__” __________ 20__</center></td> </tr> <tr> <td class='inregi'>Inregistrări actualizate și tipărite la data de <b>$ziua - $ora</b></td> </tr> </table><br> <table cellpadding='5' cellspacing='0'> <tr> <th>Nr</th> <th>Nume, prenume</th> <th>Data naşterii</th> <th>Locul naşterii</th> <th>Sex</th> <th>Domiciliul</th> <th>Telefon</th> <th>Buletin de identitate</th> <th>Cod personal</th> <th>Poliţa</th> <th>Instituţia absolvită</th> <th>Data absolvirii</th> <th>Forma de învătămînt</th> <th>Specialitatea după diplomă</th> <th>Calificarea după diplomă</th> <th>Studii</th> <th>Funcţia</th> <th>Data angajării</th> <th>Ordinul angajării</th> <th>Vechime</th> </tr>"; $i = 0; while($row = mysql_fetch_array($result)) { $i++; echo "<tr>"; echo "<th>".$i."</th>"; echo "<th>" . $row['nume'] . "</th>"; echo "<td>" . $row['date'] . "</td>"; echo "<td>" . $row['loc_nastere'] . "</td>"; echo "<td>" . $row['sex'] . "</td>"; echo "<td>" . $row['domiciliul'] . "</td>"; echo "<td>" . $row['telefon'] . "</td>"; echo "<td>" . $row['nr_pas'] . "</td>"; echo "<td>" . $row['cod_pers'] . "</td>"; echo "<td>" . $row['polita'] . "</td>"; echo "<td>" . $row['inst_abs'] . "</td>"; echo "<td>" . $row['data_abs'] . "</td>"; echo "<td>" . $row['form_stud'] . "</td>"; echo "<td>" . $row['sp_dipl'] . "</td>"; echo "<td>" . $row['cal_dipl'] . "</td>"; echo "<td>" . $row['studii'] . "</td>"; echo "<td>" . $row['functia'] . "</td>"; echo "<td>" . $row['data_angaj'] . "</td>"; echo "<td>" . $row['ordin_angaj'] . "</td>"; echo "<td>" . $row['vechime'] . "</td>"; echo "</tr>"; } echo "</ul></table><br><font class='subsol'>__________________________________________________________________________________<br>Datele ce se conţin în acest tabel nu trebuie să fie transmise persoanelor ce nu au dreptul de a le vedea.</font>"; mysql_close(); ?> </body> </html> this page look like this the problem is: when I want to print this page to simple A4 paper, the last 4-5 vertical fields(columns) of table doesn't fit into the page. so... can you help me to create a page where I will have the form with all vertical fields from table. they will look like text with chekbox. if i will check 10 fields from 15 then will be call page(raport.php) from the top of this post where will be creating the table with only 10 columns. I know it's hard to do this. but please give me at least a little example how to do this thing. thank you. sorry for my bad english Link to comment https://forums.phpfreaks.com/topic/163539-show-only-checked-fields-in-table/ Share on other sites More sharing options...
ldougherty Posted June 24, 2009 Share Posted June 24, 2009 Doing what you want to do is possible but would be very complex and not likely something anyone on here can explain to you how to do with a working example. I suggest if your are not comfortable with the concept that you hire a programmer to do so for you. A quick simple solution would be to modify the existing raport.php file as such The below lines of code reference the table row with each column reported. If you only wanted to output 10 columns then adjust the data below to only show the data you want by removing the referring lines you don't need. echo "<tr>"; echo "<th>".$i."</th>"; echo "<th>" . $row['nume'] . "</th>"; echo "<td>" . $row['date'] . "</td>"; echo "<td>" . $row['loc_nastere'] . "</td>"; echo "<td>" . $row['sex'] . "</td>"; echo "<td>" . $row['domiciliul'] . "</td>"; echo "<td>" . $row['telefon'] . "</td>"; echo "<td>" . $row['nr_pas'] . "</td>"; echo "<td>" . $row['cod_pers'] . "</td>"; echo "<td>" . $row['polita'] . "</td>"; echo "<td>" . $row['inst_abs'] . "</td>"; echo "<td>" . $row['data_abs'] . "</td>"; echo "<td>" . $row['form_stud'] . "</td>"; echo "<td>" . $row['sp_dipl'] . "</td>"; echo "<td>" . $row['cal_dipl'] . "</td>"; echo "<td>" . $row['studii'] . "</td>"; echo "<td>" . $row['functia'] . "</td>"; echo "<td>" . $row['data_angaj'] . "</td>"; echo "<td>" . $row['ordin_angaj'] . "</td>"; echo "<td>" . $row['vechime'] . "</td>"; echo "</tr>"; Link to comment https://forums.phpfreaks.com/topic/163539-show-only-checked-fields-in-table/#findComment-862914 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.