Bonjour,
s'il vous plait voila le fichier du graphe qui récupere les donnees d'une base de donnees à partir d'un formulaire
le graphe s'affiche trés bien quand j'envoi le formulaire directementà la page graphe01.php qui contien le code de selection de base de données et le code du graphe (c'est a dire action=graphe01.php)
(graphe01.php).
mais quand j'envoi le formulaire à la page image.php qui contien seulement ça:
graphe.php
==========
le graphe ne s'affiche pas; s'il vous plait ou est l'erreur.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Document sans titre</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <body> <img src="graphe01.php"> </body> </html>
voilà les fichiers php
formulaire d'envoi
formliste.php
============
le fichier qui affiche le graphe
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Document sans titre</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <style type="text/css"> <!-- .Style1 { font-size: 24px; color: #990000; } .Style2 {font-size: 24px; color: #990000; font-weight: bold; } .Style3 {font-weight: bold} .Style71 { font-size: 24px; font-weight: bold; } .Style73 {font-size: 24px; font-weight: bold; color: #000066; } body { background-image: url(image/im2.jpg); } .Style74 {font-size: 36px} .Style75 {color: #990000} .Style76 { font-size: 20px; color: #990000; font-weight: bold; } --> </style> </head> <body> <?php $lycee=$_POST['lycee']; $wilaya=$_POST['wilaya']; $pass=$_POST['pass']; echo $lycee; ?> <table width="653" border="1" align="center" background="image/im1.jpg"> <tr> <td><div align="center" class="Style73">partionner les réponses </div></td> </tr> </table> <p> </p> <table width="647" height="209" border="1" align="center" background="image/im1.jpg"> <tr class="Style2"> <td width="333" height="57"><div align="center"><span class="Style73">lycee:</span> <?php echo $lycee ?></div></td> <td width="298"><div align="center"><span class="Style73">wilaya:</span> <?php echo $wilaya ?></div></td> </tr> <tr> <td height="99" colspan="2"><div align="center" class="Style4 Style5"> <form action="graphe01.php" method="post" name="form11" id="form11"> <p> </p> <p> <select name="num_q" class="Style76" id="num_q"> <option></option> <option value="01">01</option> <option value="02">02</option> <option value="03">03</option> <option value="03">03</option> <option value="04">04</option> </select> <span class="Style73">choisir le numéro dela question </span> </p> <p> </p> <p> <input name="Submit" type="submit" class="Style76" value="envoyer"> <span class="Style4"> <input name="pass" type="hidden" id="pass" value="<?php echo $pass?>" /> <input name="wilaya" type="hidden" id="wilaya" value="<?php echo $wilaya ?>" /> <input name="lycee" type="hidden" id="lycee" value="<?php echo $lycee?>" /> </span> </p> </form> </div> <div align="center" class="Style6"></div></td> </tr> </table> </body> </html>
graphe01.php
============
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35 <?php header("content-type: image/png"); include ('../gg/src/jpgraph.php'); include ('../gg/src/jpgraph_pie.php'); $con=mysql_connect("localhost","root",""); if ($con==FALSE) die("réessayez"); $db=mysql_select_db('programme'); if ($db==FALSE) die("erreur de connexion a la base de donnees"); $num_q=$_POST['num_q']; $sql="select * from q".$num_q; $res=mysql_query($sql); if ($res==FALSE) echo mysql_error(); $data = array(); $l1 = array(); while ($line=mysql_fetch_array($res)) { $data[] = $line['nombre']; $l1[]= "rep".$line['L1']; } //$data = array(4, 8, 15, 16, 23, 42); $p = new PiePlot($data); $p->SetLabelType(PIE_VALUE_ADJPER); $p->SetLegends($l1); $p->value->SetFormat('%d'); $p->SetGuideLines(); $p->ExplodeSlice(1); // fait resortir la 2e part $g = new PieGraph(400, 400); $g->title->Set("statistiques des réponses"); $g->Add($p); $g->Stroke(); ?>
Partager