GET dans FPDF
Fermé
guyoem
Messages postés
36
Date d'inscription
vendredi 1 août 2008
Statut
Membre
Dernière intervention
22 avril 2009
-
29 déc. 2008 à 12:00
mannok - 4 janv. 2011 à 15:06
mannok - 4 janv. 2011 à 15:06
A voir également:
- GET dans FPDF
- Fpdf utf8 ✓ - Forum PHP
- Get adobe flash player - Télécharger - Divers Web & Internet
- Get data back - Télécharger - Récupération de données
- Wmic path softwarelicensingservice get oa3xoriginalproductkey - Forum Windows 10
- Get youtube - Télécharger - Téléchargement & Transfert
4 réponses
ThEBiShOp
Messages postés
8318
Date d'inscription
jeudi 22 mars 2007
Statut
Contributeur
Dernière intervention
8 février 2021
1 600
29 déc. 2008 à 12:11
29 déc. 2008 à 12:11
tu n'arrives pas à instancier la variable ou tu n'arrives pas à la transmettre via l'url ?
Bonjour
Qu'est-ce qui ne se passe pas normalement quand tu fais $c=$_GET['c'] ? Peux tu nous donner l'écriture du lien de départ avec le ?c=qqchose, et le code du script d'arrivée du lien o* le $c=$_GET['c'] ne marche pas ?
Qu'est-ce qui ne se passe pas normalement quand tu fais $c=$_GET['c'] ? Peux tu nous donner l'écriture du lien de départ avec le ?c=qqchose, et le code du script d'arrivée du lien o* le $c=$_GET['c'] ne marche pas ?
guyoem
Messages postés
36
Date d'inscription
vendredi 1 août 2008
Statut
Membre
Dernière intervention
22 avril 2009
4
29 déc. 2008 à 12:41
29 déc. 2008 à 12:41
Mon lien secrit comme ca :
<li><a href="index.php?page=Listecaissonprojet&c=<?php echo $c; ?>">Caissons</a></li>
ensuite je fè mon get dans l'index, et après je voudrè faire comme dhab faire un get dans la page mais là ca marche pas.
<li><a href="index.php?page=Listecaissonprojet&c=<?php echo $c; ?>">Caissons</a></li>
ensuite je fè mon get dans l'index, et après je voudrè faire comme dhab faire un get dans la page mais là ca marche pas.
Ton lien a l'air correct. $c contient-il des caractères spéciaux ? Le lien effectivement généré est-il bien celui que tu attends ?
fais un var_dump($_GET) dans la page où tu attends ton 'c' pour voir...
fais un var_dump($_GET) dans la page où tu attends ton 'c' pour voir...
guyoem
Messages postés
36
Date d'inscription
vendredi 1 août 2008
Statut
Membre
Dernière intervention
22 avril 2009
4
29 déc. 2008 à 14:09
29 déc. 2008 à 14:09
mon c contient juste un id, donc un entier.
guyoem
Messages postés
36
Date d'inscription
vendredi 1 août 2008
Statut
Membre
Dernière intervention
22 avril 2009
4
>
guyoem
Messages postés
36
Date d'inscription
vendredi 1 août 2008
Statut
Membre
Dernière intervention
22 avril 2009
29 déc. 2008 à 14:44
29 déc. 2008 à 14:44
en faisant le var dump il me met :
array(2) { ["page"]=> string(17) "EditQuincaillerie" ["c"]=> string(1) "1" }
Et sinon je me suis rendu compte qu'il accepte le C justqu'à temps que je fasse le Output.
A partir du moment ou je met le output il me met le message suivant :
Warning: Cannot modify header information - headers already sent by (output started at d:\projet bfp\pfe\sitebfp\index.php:11) in d:\projet bfp\pfe\sitebfp\fpdf.php on line 1017
FPDF error: Some data has already been output, can't send PDF file
array(2) { ["page"]=> string(17) "EditQuincaillerie" ["c"]=> string(1) "1" }
Et sinon je me suis rendu compte qu'il accepte le C justqu'à temps que je fasse le Output.
A partir du moment ou je met le output il me met le message suivant :
Warning: Cannot modify header information - headers already sent by (output started at d:\projet bfp\pfe\sitebfp\index.php:11) in d:\projet bfp\pfe\sitebfp\fpdf.php on line 1017
FPDF error: Some data has already been output, can't send PDF file
guyoem
Messages postés
36
Date d'inscription
vendredi 1 août 2008
Statut
Membre
Dernière intervention
22 avril 2009
4
>
guyoem
Messages postés
36
Date d'inscription
vendredi 1 août 2008
Statut
Membre
Dernière intervention
22 avril 2009
29 déc. 2008 à 14:53
29 déc. 2008 à 14:53
Je viens de me rendre compte que le bug ne vient pas de mon get c ke je fè dans ma page mè de : mon get c dans ma page index.
if ($_GET['page'] == "EditQuincaillerie")
{
$c=$_GET['c'];
include("EditQuincaillerie.php");
}
le script ci dessus je le fais pour tte les autres pages et ca marche trè bien.
if ($_GET['page'] == "EditQuincaillerie")
{
$c=$_GET['c'];
include("EditQuincaillerie.php");
}
le script ci dessus je le fais pour tte les autres pages et ca marche trè bien.
Normal que le var_dump te provoque ce warning, il servait juste au diagnostic, tu peux le retirer : on sait que la variable est bien passée.
Mais je ne comprends pas ta réponse : le bug ne vient pas de mon get c ke je fè dans ma page mè de : mon get c dans ma page index.
Tu utilises donc deux fois $_GET['c'] ? Dans deux pages différentes ? Pas très clair ...
Peux-tu faire echo $c; juste après ton $c=$_GET['c']; ?
Mais je ne comprends pas ta réponse : le bug ne vient pas de mon get c ke je fè dans ma page mè de : mon get c dans ma page index.
Tu utilises donc deux fois $_GET['c'] ? Dans deux pages différentes ? Pas très clair ...
Peux-tu faire echo $c; juste après ton $c=$_GET['c']; ?
guyoem
Messages postés
36
Date d'inscription
vendredi 1 août 2008
Statut
Membre
Dernière intervention
22 avril 2009
4
30 déc. 2008 à 11:32
30 déc. 2008 à 11:32
Problème résolu, il ne fallait pas passer par llindex, tout simplement.
Merci de votre aide
Merci de votre aide
Je n'arrive pas à afficher les premières valeurs de ma requête.
Aidez-moi s'il vous plait à trouver l'erreur et corriger !
Voici le code pour générer le PDF :
Aidez-moi s'il vous plait à trouver l'erreur et corriger !
Voici le code pour générer le PDF :
<?php
if (!isset($_SESSION)) {
session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";
// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && true) {
$isValid = true;
}
}
return $isValid;
}
$MM_restrictGoTo = "connexion.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$MM_referrer .= "?" . $QUERY_STRING;
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
if (isset($_GET['pontbascule'])) {
$colpontbascule_rsLivraison = (get_magic_quotes_gpc()) ? $_GET['pontbascule'] : addslashes($_GET['pontbascule']);
}
if (isset($_GET['debut'])) {
$coldebut_rsLivraison = (get_magic_quotes_gpc()) ? $_GET['debut'] : addslashes($_GET['debut']);
}
if (isset($_GET['producteur'])) {
$colproducteur_rsLivraison = (get_magic_quotes_gpc()) ? $_GET['producteur'] : addslashes($_GET['producteur']);
}
if (isset($_GET['fin'])) {
$colfin_rsLivraison = (get_magic_quotes_gpc()) ? $_GET['fin'] : addslashes($_GET['fin']);
}
if ( $colproducteur_rsLivraison == '%' ) { $colproducteur = '' ;}
else { $colproducteur = $colproducteur_rsLivraison ;}
if ( $colpontbascule_rsLivraison == '%' ) { $colpontbascule = '' ;}
else { $colpontbascule = $colpontbascule_rsLivraison ;}
if ( $coldebut_rsLivraison == '' ) { $coldebut = '' ;}
else { $coldebut = changedateusfr($coldebut_rsLivraison) ;}
if ( $colfin_rsLivraison == '' ) { $colfin = '' ;}
else { $colfin = changedateusfr($colfin_rsLivraison) ;}
require('fpdf.php');
//Connect to your database
include("Connections/mabase.php");
//Create new pdf file
$pdf=new FPDF();
$pdf->AliasNbPages();
//Variables
$user=$_SESSION['MM_Username'];
$date=date("d").'/'.date("m").'/'.date("Y");
$heure=date("H").'h'.date("i");
//Fonction pour changer le format d'affichage de la date du style anglais au français
function changedateusfr($dateus)
{
$datefr=$dateus{8}.$dateus{9}."-".$dateus{5}.$dateus{6}."-".$dateus{0}.$dateus{1}.$dateus{2}.$dateus{3};
return $datefr;
}
//Disable automatic page break
$pdf->SetAutoPageBreak(false);
//Add first page
$pdf->AddPage();
//set initial y axis position per page
$y_initial = 50;
$y_next = 20;
$y_footer = -20;
//Set Row Height
$row_height = 5;
//print logo
$pdf->Image('images/slogo.jpg',22,10,20);
//print date
$pdf->SetFillColor(255,255,255);
$pdf->SetFont('Arial','',9);
$pdf->SetXY(165,15);
$pdf->Cell(20,5,$date.' - '.$heure,0,0,'R');
//print title
$pdf->SetFillColor(255,255,255);
$pdf->SetFont('Arial','BU',12);
$pdf->SetXY(55,30);
$pdf->Cell(100,7,'SITUATION DE LIVRAISON',0,0,'C');
//print column titles
$pdf->SetFillColor(190,190,190);
$pdf->SetFont('Arial','B',9);
$pdf->SetXY(25,$y_initial);
$pdf->Cell(18,5,'DATE',1,0,'L',1);
$pdf->Cell(55,5,'PRODUCTEUR',1,0,'L',1);
$pdf->Cell(27,5,'PONT BASCULE',1,0,'L',1);
$pdf->Cell(15,5,'TRANSP',1,0,'L',1);
$pdf->Cell(20,5,'MODE PAIE',1,0,'L',1);
$pdf->Cell(25,5,'QUANTITE',1,0,'R',1);
$y_axis = $y_initial + $row_height;
//print footer
$pdf->SetFillColor(255,255,255);
$pdf->SetFont('Arial','',9);
$pdf->SetXY(165,-20);
//$pdf->Cell(100,5,'Edité par '.$user,0,0,'L');
$pdf->Cell(20,5,'Page '.$pdf->PageNo().'/{nb}',0,0,'R');
//Select data you want to show in your PDF file
$query_val_producteur = "SELECT id_producteur, code, nomprenom FROM producteur WHERE id_producteur LIKE '$colproducteur' " ;
$val_producteur = mysql_query($query_val_producteur, $mabase) or die(mysql_error());
$row_val_producteur = mysql_fetch_assoc($val_producteur);
$val_producteur = $row_val_producteur['nomprenom'];
$query_val_pontbascule = "SELECT id_pontbascule, nom_pbascule FROM pontbascule WHERE id_pontbascule LIKE '$colpontbascule' " ;
$val_pontbascule = mysql_query($query_val_pontbascule, $mabase) or die(mysql_error());
$row_val_pontbascule = mysql_fetch_assoc($val_pontbascule);
$val_pontbascule = $row_val_pontbascule['nom_pbascule'];
$query_rsLivraison = sprintf("SELECT * FROM livraison, pontbascule, producteur WHERE livraison.pontbascule LIKE '%s' AND livraison.producteur LIKE '%s' AND livraison.pontbascule=pontbascule.id_pontbascule AND livraison.producteur=producteur.id_producteur AND (date_livraison BETWEEN '%s' AND '%s') ORDER BY livraison.date_livraison ASC, producteur.nomprenom ASC", $colpontbascule_rsLivraison, $colproducteur_rsLivraison, $coldebut_rsLivraison, $colfin_rsLivraison);
$rsLivraison = mysql_query($query_rsLivraison, $mabase) or die(mysql_error());
$row_rsLivraison = mysql_fetch_array($rsLivraison);
$totalRows_rsLivraison = mysql_num_rows($rsLivraison);
$row_height = 10;
$pdf->SetFillColor(255,255,255);
$pdf->SetFont('Arial','',9);
$pdf->SetXY(25,42);
$pdf->Cell(73,5,$val_producteur,0,0,'L');
$pdf->Cell(24,5,$val_pontbascule,0,0,'L');
$pdf->Cell(23,5,'Période : ',0,0,'R');
$pdf->Cell(40,5,$coldebut.' au '.$colfin,0,0,'R');
//initialize counter
$i = 0;
//Set maximum rows for first page
$max = 43;
$row_height = 10;
$pdf->SetFillColor(255,255,255);
$pdf->SetFont('Arial','B',9);
$pdf->SetXY(25,55);
$pdf->Cell(18,210,'',1,0,'C',1);
$pdf->Cell(55,210,'',1,0,'C',1);
$pdf->Cell(27,210,'',1,0,'C',1);
$pdf->Cell(15,210,'',1,0,'C',1);
$pdf->Cell(20,210,'',1,0,'C',1);
$pdf->Cell(25,210,'',1,0,'R',1);
$total_qte=0;
while($row_rsLivraison = mysql_fetch_assoc($rsLivraison))
{
$total_qte += $row_rsLivraison['quantite'];
//If the current row is the last one, create new page and print column title
if ( $i == $max )
{
$pdf->AddPage();
//print column titles for the current page
$row_height = 5;
$pdf->SetFillColor(190,190,190);
$pdf->SetFont('Arial','B',9);
$pdf->SetXY(25,$y_next);
$pdf->Cell(18,5,'DATE LIVR',1,0,'L',1);
$pdf->Cell(55,5,'PRODUCTEUR',1,0,'L',1);
$pdf->Cell(27,5,'PONT BASCULE',1,0,'L',1);
$pdf->Cell(15,5,'TRANSP.',1,0,'L',1);
$pdf->Cell(20,5,'MODE PAIE',1,0,'L',1);
$pdf->Cell(25,5,'QUANTITE',1,0,'R',1);
//Go to next row
$i = 0;
$y_axis = $y_next + $row_height;
//print footer
$pdf->SetFillColor(255,255,255);
$pdf->SetFont('Arial','',9);
$pdf->SetXY(25,-20);
$pdf->Cell(160,5,'Page '.$pdf->PageNo().'/{nb}',0,0,'R');
//Set $i variable to 0 (first row)
$i = 0;
//Set maximum rows per page
$max = 48;
//print total
$row_height = 10;
$pdf->SetFillColor(255,255,255);
$pdf->SetFont('Arial','B',9);
$pdf->SetXY(25,25);
$pdf->Cell(18,240,'',1,0,'C',1);
$pdf->Cell(55,240,'',1,0,'C',1);
$pdf->Cell(27,240,'',1,0,'C',1);
$pdf->Cell(15,240,'',1,0,'C',1);
$pdf->Cell(20,240,'',1,0,'C',1);
$pdf->Cell(25,240,'',1,0,'R',1);
//print total
if ( $pdf->PageNo()*$max >= $totalRows_rsLivraison )
{ $row_height = 10;
$pdf->SetFillColor(255,255,255);
$pdf->SetFont('Arial','B',9);
$pdf->SetXY(25,265);
$pdf->Cell(135,7,'TOTAL',1,0,'C',1);
$pdf->Cell(25,7,number_format($total_qte, 0, ',', ' ').' kg',1,0,'R',1);
}
}
//data
$date = changedateusfr($row_rsLivraison['date_livraison']);
$producteur = $row_rsLivraison['nomprenom'];
$pontbascule = $row_rsLivraison['nom_pbascule'];
$transport = $row_rsLivraison['mode_transport'];
$paiement = $row_rsLivraison['mode_paiement'];
$quantite = number_format($row_rsLivraison['quantite'], 0, ',', ' ').' kg';
$row_height = 5;
$pdf->SetFillColor(255,255,255);
$pdf->SetFont('Arial','',9);
$pdf->SetXY(25,$y_axis);
$pdf->Cell(18,5,$date,1,0,'L',1);
$pdf->Cell(55,5,$producteur,1,0,'L',1);
$pdf->Cell(27,5,$pontbascule,1,0,'L',1);
$pdf->Cell(15,5,$transport,1,0,'L',1);
$pdf->Cell(20,5,$paiement,1,0,'L',1);
$pdf->Cell(25,5,$quantite,1,0,'R',1);
//Go to next row
$y_axis = $y_axis + $row_height;
$i = $i + 1;
//print total
if ( $max >= $totalRows_rsLivraison )
{
$row_height = 10;
$pdf->SetFillColor(255,255,255);
$pdf->SetFont('Arial','B',9);
$pdf->SetXY(25,265);
$pdf->Cell(135,7,'TOTAL',1,0,'C',1);
$pdf->Cell(25,7,number_format($total_qte, 0, ',', ' ').' kg',1,0,'R',1);
}
}
mysql_close($mabase);
//Send file
$pdf->Output('situation_livraison.pdf', 'I');
?>