Ho fatto un po di pulizia e cambiato come dicevi ma mi ritrovo con 2 errori
file index2.php
se clicco su pdf non succede niente non mi apre nessuna pagina
<?php
include_once 'connessionedbaruba.php';
if(isset($_GET['delete_id']))
{
$sql_query="DELETE FROM rubrica WHERE id=".$_GET['delete_id'];
mysqli_query($conn,$sql_query);
header("Location: $_SERVER[PHP_SELF]");
}
//if(isset($_GET['changestatus_id']))
//{
// $sql_query="UPDATE rubrica SET `status`='".$_GET['status']."' WHERE id=".$_GET['changestatus_id'];
// mysqli_query($conn,$sql_query);
// header("Location: $_SERVER[PHP_SELF]");
//}
?>
<!DOCTYPE html ><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>RUBRICA</title>
<!-- Bootstrap -->
</head>
<link rel="stylesheet" href="style.css" type="text/css" />
<script type="text/javascript">
function edt_id(id)
{
window.location.href='edit_rubrica.php?edit_id='+id;
}
function view_id(id)
{
window.location.href='view_rubrica.php?view_id='+id;
}
function delete_id(id)
{
if(confirm('Sure to Delete ?'))
{
window.location.href='index2.php?delete_id='+id;
}
function pdfcli_id(id)
{
window.location.href='pdfcli.php?pdfcli_id='+id;
}
}
//function changestatus_id(id,status)
//{
// window.location.href='index2.php?changestatus_id='+id+'&status='+status;
//}
</script>
</head>
<body>
<center>
<div id="header">
<div id="content">
<label>LA MIA RUBRICA </label>
</div>
</div>
<div id="body">
<div id="content">
<table align="center">
<tr>
<th colspan="5"><a href="add_rubrica.php">AGGIUNGI A RUBRICA</a></th>
</tr>
<th width="10%">SL NO</th>
<th width="10%">nome</th>
<th colspan="4">Actions</th>
</tr>
<?php
$sql_query="SELECT * FROM rubrica";
$result_set=mysqli_query($conn,$sql_query);
$i=1;
while($row=mysqli_fetch_row($result_set))
{
?>
<tr>
<td align="center" ><?php echo $i; ?></td>
<td align="center" > <a href="javascript:view_id('<?php echo $row[0]; ?>')"> <?php echo $row[1]; ?> </a> </td>
<!--
<?php if($row[count($row)-1]==1) { ?>
<td width="22%" align="center"><a href="javascript:changestatus_id('<?php echo $row[0]; ?>',0)">Deactivate</a></td>
<?php } else { ?>
<td width="19%" align="center"><a href="javascript:changestatus_id('<?php echo $row[0]; ?>',1)">Activate</a></td>
<?php }
?>
-->
<td width="10%" align="center"><a href="javascript:edt_id('<?php echo $row[0]; ?>')">Edit</a></td>
<td width="10%" align="center"><a href="javascript:delete_id('<?php echo $row[0]; ?>')">Delete</a></td>
<td width="10%" align="center"><a href="javascript:pdfcli_id('<?php echo $row[0]; ?>')">Pdf</a></td>
</tr>
<?php
$i++;
}
?>
</table>
</div>
</div>
</center>
</body>
</html>
nel file pdfcli.php
mi compare
Fatal error: Uncaught Exception: FPDF error: Some data has already been output, can't send PDF file in /web/htdocs/
www.dueb.net/home/dueb/fpdf181/fpdf.php:27 Stack trace: #0 /web/htdocs/: FPDF->Error('Some data has a...') #1 /web/htdocs/: FPDF->_checkoutput() #2 /web/htdocs/: FPDF->Output() #3 {main} thrown in /web/htdocs/
www.dueb.net/home/dueb/fpdf181/fpdf.ph on line 271
<?php
ob_start();
require_once('fpdf181/fpdf.php');
//Connect to your database
require_once('connessionedbaruba.php');
//Select the Products you want to show in your PDF file
$sql_query="SELECT * FROM rubrica WHERE id=".$_GET['edit_id'];
//Initialize the 3 columns
$column_nome = "";
$column_cognome = "";
$column_indirizzo = "";
$column_telefono = "";
//For each row, add the field to the corresponding column
//while($row = mysqli_fetch_array($result))
//{
//
// $nome = $row["nome"];
// $cognome = $row["cognome"];
// $indirizzo = $row["indirizzo"];
// $telefono = $row["telefono"];
$column_nome = $column_nome.$nome."\n";
$column_cognome = $column_cognome.$cognome."\n";
$column_indirizzo = $column_indirizzo.$indirizzo."\n";
$column_telefono = $column_telefono.$telefono."\n";
//}
mysqli_close($conn);
//Create a new PDF file
$pdf=new FPDF();
$pdf->AddPage('L');
//Fields Name position
$Y_Fields_Name_position = 10;
//Table position, under Fields Name
$Y_Table_Position = 26;
//First create each Field Name
//Gray color filling each Field Name box
$pdf->SetFillColor(252,252,252);
//Bold Font for Field Name
$pdf->SetFont('Arial','B',12);
$pdf->SetY($Y_Fields_Name_position);
$pdf->SetX(35);
$pdf->Cell(40,6,'NOME',1,0,'L',1);
$pdf->SetX(75);
$pdf->Cell(50,6,'COGNOME',1,0,'L',1);
$pdf->SetX(125);
$pdf->Cell(70,6,'INDIRIZZO',1,0,'L',1);
$pdf->SetX(195);
$pdf->Cell(30,6,'TELEFONO',1,0,'L',1);
$pdf->Ln();
//Now show the 3 columns
$pdf->SetFont('Arial','',12);
$pdf->SetY($Y_Table_Position);
$pdf->SetX(35);
$pdf->MultiCell(40,6,$column_nome,1);
$pdf->SetY($Y_Table_Position);
$pdf->SetX(75);
$pdf->MultiCell(50,6,$column_cognome,1);
$pdf->SetY($Y_Table_Position);
$pdf->SetX(125);
$pdf->MultiCell(70,6,$column_indirizzo,1);
$pdf->SetY($Y_Table_Position);
$pdf->SetX(195);
$pdf->MultiCell(30,6,$column_telefono,1);
//Create lines (boxes) for each ROW (Product)
//If you don't use the following code, you don't create the lines separating each row
ob_end_flush();
$pdf->Output();
?>