Précédent   Forum des professionnels en informatique > PHP > Bibliothèques et frameworks > PDF > FPDF
FPDF Forum d'entraide pour la bibliothèque FPDF permettant de générer des documents PDF en PHP. Avant de poster -> tutoriels FPDF
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 15/06/2006, 12h55   #1
Candidat au titre de Membre du Club
 
Inscription : mars 2006
Messages : 89
Détails du profil
Informations forums :
Inscription : mars 2006
Messages : 89
Points : 10
Points : 10
Par défaut [FPDF] envoi de donnes dans document pdf

Bonjour à tous,
mon probléme est le suivant :

J'ai un formulaire de saisie pour recueillir des infomations afin de remplir un certificat de cession de véhicule.
ces infos, je les récupérerai plus tard ( variables php ) , et je souhaite que quand la personne valide le formulaire, cela imprime le certificat de cession avec les infos à l'intérieur.
J'ai fouiné un peu, fpdf... Les forums... BREF, je cherche !

Ma question est la suivante : quelle est la meilleur solution pour faire ce genre de chose ?

Voici le code du formulaire :
Code :
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<form name="certif_cession" method="post" action="traitement.php">
  <table width="618px"  border="0" cellspacing="0" cellpadding="0" height="480px">
 
	<tr height="40px" valign="top">
		<td colspan="4">
			<div id="admin_concessionnaire">
				<h1>Certificat de cession automobile</h1>
				<h2>Remplir le certificat</h2>
			</div>
		</td>
	</tr>
 
    <tr bgcolor="#FFFFFF">
      <td><strong>Vendeur</strong></td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td><div align="right">Nom<br>
 
        ou
      DENOMINATION </div></td>
      <td><input name="nom" type="text" id="nom" size="15"></td>
      <td width="150" height="30"><div align="right">Prenoms </div></td>
      <td><input name="prenom" type="text" id="prenom" size="15"></td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td><div align="right">Adresse</div></td>
 
      <td colspan="3"><input name="adresse" type="text" id="adresse" size="50"></td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td><div align="right">CP</div></td>
      <td><input name="codepostal" type="text" id="codepostal" size="5" maxlength="5"></td>
      <td width="150" height="30"><div align="right">Ville</div></td>
      <td><input name="ville" type="text" id="ville" size="15"></td>
    </tr>
 
    <tr bgcolor="#FFFFFF">
      <td><div align="right">Ce v&eacute;hicule est VENDU ou CEDE &agrave; titre gratuit </div></td>
      <td><select name="vendu" id="vendu">
        <option value="1" selected>vente</option>
        <option value="0">cession &agrave; titre gratuit</option>
 
      </select></td>
      <td width="150" height="30">&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td><div align="right"><input name="datedecession" type="text" id="datedecession" size="10" maxlength="10">Date de la vente </div></td>
      <td></td>
      <td width="150" height="30"><div align="right">Lieu de la vente </div></td>
 
      <td><input name="lieudecession" type="text" id="lieudecession" size="15"></td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td width="150" height="30">&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr bgcolor="#FFFFFF">
 
      <td><strong>Informations tir&eacute;es de la carte grise </strong></td>
      <td>&nbsp;</td>
      <td width="150" height="30">&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td><div align="right">Immatriculation du v&eacute;hicule </div></td>
 
      <td><input name="immatriculation" type="text" id="immatriculation" size="10" maxlength="10"></td>
      <td width="150" height="30"><div align="right">n&deg; d'exploitant agricole </div></td>
      <td><input name="no_exploitant" type="text" id="no_exploitant" size="5"></td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td><div align="right">Marque</div></td>
      <td><select name="marque">
 
          <option value="Aixam">Aixam</option><option value="Alfa Roméo">Alfa Roméo</option><option value="Aro">Aro</option><option value="Aston Martin">Aston Martin</option><option value="Audi">Audi</option><option value="Austin">Austin</option><option value="Autobianchi">Autobianchi</option><option value="Bentley">Bentley</option><option value="Bertone">Bertone</option><option value="BMW">BMW</option><option value="Buick">Buick</option><option value="Cadillac">Cadillac</option><option value="Caterham">Caterham</option><option value="Chevrolet">Chevrolet</option><option value="Chrysler">Chrysler</option><option value="Citroën">Citroën</option><option value="Corvette">Corvette</option><option value="Dacia">Dacia</option><option value="Daewoo">Daewoo</option><option value="Daihatsu">Daihatsu</option><option value="De Tomaso">De Tomaso</option><option value="Dodge">Dodge</option><option value="Donkervoort">Donkervoort</option><option value="Ferrari">Ferrari</option><option value="Fiat">Fiat</option><option value="Ford">Ford</option><option value="Honda">Honda</option><option value="Hummer">Hummer</option><option value="Hyundai">Hyundai</option><option value="Isuzu">Isuzu</option><option value="Iveco">Iveco</option><option value="Jaguar">Jaguar</option><option value="Jeep">Jeep</option><option value="Kia">Kia</option><option value="Lada">Lada</option><option value="Lamborghini">Lamborghini</option><option value="Lancia">Lancia</option><option value="Land Rover">Land Rover</option><option value="Lexus">Lexus</option><option value="Ligier">Ligier</option><option value="Lotus">Lotus</option><option value="Mahindra">Mahindra</option><option value="Maserati">Maserati</option><option value="Maybach">Maybach</option><option value="Mazda">Mazda</option><option value="Mercedes">Mercedes</option><option value="MG">MG</option><option value="Mini">Mini</option><option value="Mitsubishi">Mitsubishi</option><option value="Morgan">Morgan</option><option value="Nissan">Nissan</option><option value="Opel">Opel</option><option value="Pagani">Pagani</option><option value="Peugeot">Peugeot</option><option value="PGO">PGO</option><option value="Pontiac">Pontiac</option><option value="Porsche">Porsche</option><option value="Range Rover">Range Rover</option><option value="Renault">Renault</option><option value="Rolls-Royce">Rolls-Royce</option><option value="Rover">Rover</option><option value="Saab">Saab</option><option value="Sans Marque">Sans Marque</option><option value="Santana">Santana</option><option value="Seat">Seat</option><option value="Skoda">Skoda</option><option value="Smart">Smart</option><option value="Ssangyong">Ssangyong</option><option value="Subaru">Subaru</option><option value="Suzuki">Suzuki</option><option value="Toyota">Toyota</option><option value="Tvr">Tvr</option><option value="Venturi">Venturi</option><option value="Volkswagen">Volkswagen</option><option value="Volvo">Volvo</option>      </select></td>
 
      <td width="150" height="30"><div align="right">Type variante version </div></td>
      <td><input name="version" type="text" id="version" size="15" maxlength="25"></td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td><div align="right">Genre National </div></td>
      <td><input name="genre" type="text" id="genre" size="5" maxlength="4"></td>
      <td width="150" height="30"><div align="right">Carrosserie nationale </div></td>
 
      <td><input name="carrosserie" type="text" id="carrosserie" size="8" maxlength="8">
	  </td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td><div align="right">Date de 1&egrave;re immatriculation</div></td>
      <td><input name="datedemiseencirculation" type="text" id="datedemiseencirculation" size="10" maxlength="10"></td>
      <td width="150" height="30"><div align="right">Num&eacute;ro d'identification </div></td>
 
      <td><input name="no_vin" type="text" id="no_vin" size="17" maxlength="17"></td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td><div align="right">Le v&eacute;hicule est-il destin&eacute; &agrave; la destruction </div></td>
      <td><select name="destruction" id="destruction">
          <option value="1">oui</option>
 
          <option value="0" selected>non</option>
      </select></td>
      <td width="150" height="30"><div align="right">Puissance en CV </div></td>
      <td><input name="puissance" type="text" id="puissance" size="5"></td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td><div align="right">Kilom&egrave;trage</div></td>
 
      <td><input name="kilometrage" type="text" id="kilometrage" size="7"></td>
      <td width="150" height="30"><div align="right">km pouvant &ecirc;tre justifi&eacute; </div></td>
      <td><select name="kms_certifies" id="kmcertifies">
        <option value="1">oui</option>
        <option value="0" selected>non</option>
      </select></td>
 
    </tr>
    <tr bgcolor="#FFFFFF">
      <td colspan="4">Le v&eacute;hicule n'a pas subi de transformation notable
        <select name="transformations" id="transformations">
          <option value="1" selected>oui</option>
          <option value="0">non</option>
                </select></td>
    </tr>
 
    <tr bgcolor="#FFFFFF">
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td width="150" height="30">&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td><strong>Acheteur</strong></td>
 
      <td>&nbsp;</td>
      <td width="150" height="30">&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td><div align="right">Nom<br>
        ou
      DENOMINATION pour les entreprises </div></td>
      <td><input name="nom_acheteur" type="text" id="nom_acheteur" size="15"></td>
 
      <td width="150" height="30"><div align="right">Prenoms</div></td>
      <td><input name="prenom_acheteur" type="text" id="prenom_acheteur" size="15"></td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td><div align="right">Adresse</div></td>
      <td colspan="3"><input name="adresse_acheteur" type="text" id="adresse_acheteur" size="50"></td>
    </tr>
    <tr bgcolor="#FFFFFF">
 
      <td><div align="right">CP</div></td>
      <td><input name="codepostal_acheteur" type="text" id="codepostal_acheteur" size="5"></td>
      <td width="150" height="30"><div align="right">Ville</div></td>
      <td><input name="ville_acheteur" type="text" id="ville_acheteur" size="15"></td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td><input type="submit" name="Submit" value="Visualiser et Imprimer"></td>
      <td>&nbsp;</td>
 
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
  </table>
</form>

et je voudrais insérer ces données dans un document de ce type !



Merci de vos conseils...
gator est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 15/06/2006, 21h56   #2
Membre expérimenté
 
Développeur Web
Inscription : avril 2006
Messages : 430
Détails du profil
Informations personnelles :
Localisation : Belgique

Informations professionnelles :
Activité : Développeur Web

Informations forums :
Inscription : avril 2006
Messages : 430
Points : 538
Points : 538
Salut,

une solution qui marche bien est: fdf (attention, pas fpdf, qui est une lib servant à créer des pdf)

http://fr2.php.net/fdf

Concrètement (et brièvement), avec Acrobat, tu ouvres ton PDF, tu définis les zones éditables en positionnant des checkbox, des input text, etc etc.
Ensuite, dans ton script php, tu indiques quel est le fichier PDF (devenu maintenant FDF suite à l'ajout de ces élements de formulaire), tu assignes tes valeurs aux noms des champs dans le FDF, tu output le tout, et tadaaaaaam, tu auras ton PDF avec les champs remplis. En gros.
bkill est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 16/06/2006, 12h50   #3
Candidat au titre de Membre du Club
 
Inscription : mars 2006
Messages : 89
Détails du profil
Informations forums :
Inscription : mars 2006
Messages : 89
Points : 10
Points : 10
Par défaut merci de ton aide

Merci pour tes conseils, je veais aller voir de suite te je te tiens au courant ;-)
gator est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 16/06/2006, 14h49   #4
Candidat au titre de Membre du Club
 
Inscription : mars 2006
Messages : 89
Détails du profil
Informations forums :
Inscription : mars 2006
Messages : 89
Points : 10
Points : 10
Par défaut impossible de telecharger FDF toolkit SDK 5.0

Bien li la doc, apparemment, c'est exactement ce qu'il me faut !

Par contre, impossible de télécharger FDF toolkit SDK, sur le site d'adobe !

Il me le faut car je suis en php 4.4 , et je dois installer la sdk.

Y aurait il une autre adresse pour le télécharger ?
gator est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 16/06/2006, 18h10   #5
Candidat au titre de Membre du Club
 
Inscription : mars 2006
Messages : 89
Détails du profil
Informations forums :
Inscription : mars 2006
Messages : 89
Points : 10
Points : 10
Par défaut 50% Résolu

C'est la fête !

j'ai donc mon fichier cession_pdf.php qui est opérationnel et me génére mon pdf avec les données.

Il me reste à remplacer les données par celles de ma base.

J'ai un fichier edit.php, qui affiche les caracteristiques du vehicule, j'aimerais rajouter un lien sur cession_pdf.php , qui, une fois cliqué, prendrait en compte les variables .

exemple : dans mon fichier cession_pdf.php, j'ai : 'nom1' => 'garage toto,

je voudrais que toto soit remplacé par $dealer, mais quel est la syntaxe ?

Voici mon code pour cession_pdf.php

Code :
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
<?php
 
// adresse ou se trouve le fichier pdf
$form = 'http://www.garagetoto/search/cession.pdf';
 
function create_fdf ($pdffile, $strings, $keys)
{
   $fdf = "%FDF-1.2\n%????\n";
   $fdf .= "1 0 obj \n<< /FDF << /Fields [\n";
 
   foreach ($strings as $key => $value)
   {
       $key = addcslashes($key, "\n\r\t\\()");
       $value = addcslashes($value, "\n\r\t\\()");
       $fdf .= "<< /T ($key) /V ($value) >> \n";
   }
   foreach ($keys as $key => $value)
   {
       $key = addcslashes($key, "\n\r\t\\()");
       $fdf .= "<< /T ($key) /V /$value >> \n";
   }
 
   $fdf .= "]\n/F ($pdffile) >>";
   $fdf .= ">>\nendobj\ntrailer\n<<\n";
   $fdf .= "/Root 1 0 R \n\n>>\n";
   $fdf .= "%%EOF";
 
   return $fdf;
}
 
// listage des champs textes
$strings = array(
   'nom1' => 'garage toto',
   'nom2' => '',
   'adresse' => 'ZA LE PRE DROUE',
   'codepostal' => '88150',
   'ville' => 'CHAVELOT',
   'jour' => '16',
   'mois' => '06',
   'année' => '2006',
   'numéroimmatriculation' => '6455VE88',
   'J1' => 'VP',
   'D1' => 'VOLKSWAGEN',
   'D2' => 'GBC8KT',
   'E' => 'WAZZZ4521452145',
   'J3' => 'FG4521',
   'P6' => '06',
   'Bjour' => '12',
   'Bmois' => '09',
   'Bannée' => '1999',
   'anomprénom' => 'GERARD LENORMAND',
   'adresse1' => '14 RUE DE LA PIE QUI CHANTE',
   'codeposta1' => '54000',
   'ville1' => 'NETLAND',
   'destruction' => '',
   'lieu' => 'CHAVELOT',
   'date' => '16/06/2006'
   );
 
// listage des  cases a cocher / boutons radios
$keys = array('
   gender' => 'male',// bouton radio
   'transformation' => 'on',// case a cocher 
   'vendu' => 'on',// case a cocher 
   'urgent' => 'On'// case a cocher 
   );
 
// Output  du formulaire
header('Content-type: application/vnd.fdf');
echo create_fdf($form, $strings, $keys);
 
?>

et voici mon fichier edit.php

Code :
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
<?php
/************ INCLUDE SECTION ************/
include('../../include/ErrorHandler/error_handler.php');
include('../../include/global.php');
include('../include/auth.php');
include('../../include/connection.php');
include('../../include/functions.php');
include('../../include/validation.php');
 
if(!isset($HTTP_GET_VARS["id"]) || $HTTP_GET_VARS["id"]=="")
	die(header('location: index.php'));
 
 
$error_msg = "";
$msg = "";
if($HTTP_SERVER_VARS['REQUEST_METHOD']=="POST") 
{
	/**** SERVER VALIDATION ****/
	if(!(chk($HTTP_POST_VARS['year'],"IsNotEmpty,IsNumber")))
	    $error_msg.= "- Please enter a Year<br>";
	if(!(chk($HTTP_POST_VARS['model'],"IsNotEmpty")))
	    $error_msg.= "- Please enter a Make<br>";
	if(!(chk($HTTP_POST_VARS['type'],"IsNotEmpty")))
	    $error_msg.= "- Please enter a Model<br>";
	if(!(chk($HTTP_POST_VARS['engine'],"IsNotEmpty")))
	    $error_msg.= "- Please enter an Engine<br>";
	if(!(chk($HTTP_POST_VARS['trans'],"IsNotEmpty")))
	    $error_msg.= "- Please enter a Trans<br>";
	if(!(chk($HTTP_POST_VARS['drive'],"IsNotEmpty")))
	    $error_msg.= "- Please enter a Drive<br>";
	if(!(chk($HTTP_POST_VARS['color'],"IsNotEmpty")))
	    $error_msg.= "- Please enter a Color<br>";
	if(!(chk($HTTP_POST_VARS['millage'],"IsNotEmpty,IsNumber")))
	    $error_msg.= "- Please enter a valid numeric value for Millage<br>";
	if(!(chk($HTTP_POST_VARS['price'],"IsMoney")))
	    $error_msg.= "- Please enter a valid money value for Price<br>";
	if(!(chk($HTTP_POST_VARS['low'],"IsMoney")))
	    $error_msg.= "- Please enter a valid money value for Low Book<br>";
	if(!(chk($HTTP_POST_VARS['high'],"IsMoney")))
	    $error_msg.= "- Please enter a valid money value for High Book<br>";
	if(!(chk($HTTP_POST_VARS['certified'],"IsSelected")))
		$error_msg.= "- Please select an option for Certified<br>";
 
	if(isset($HTTP_POST_VARS['special']))
		$special="Y";
	else
		$special="N";
	if($error_msg == "") 
	{
		#############################################################################
		#	IF MAGIC QUOTE IN PHP.INI IS SET OFF ADD SLASHES TO SUBMITED VARIABLES	#
		#############################################################################
		$sql = "UPDATE ".$db_prefix."cars SET
					stored='".$HTTP_POST_VARS['stored_year']."-".$HTTP_POST_VARS['stored_month']."-".$HTTP_POST_VARS['stored_day']."',
					year='".add_slashes($HTTP_POST_VARS['year'])."',
					model='".add_slashes($HTTP_POST_VARS['model'])."',
					type='".add_slashes($HTTP_POST_VARS['type'])."',
					engine='".add_slashes($HTTP_POST_VARS['engine'])."',
					trans='".add_slashes($HTTP_POST_VARS['trans'])."',
					drive='".add_slashes($HTTP_POST_VARS['drive'])."',
					color='".add_slashes($HTTP_POST_VARS['color'])."',
					millage='".add_slashes($HTTP_POST_VARS['millage'])."',
					vin='".add_slashes($HTTP_POST_VARS['vin'])."',
					price='".add_slashes(strip_out($HTTP_POST_VARS['price']))."',
					low='".add_slashes(strip_out($HTTP_POST_VARS['low']))."',
					high='".add_slashes(strip_out($HTTP_POST_VARS['high']))."',
					features='".add_slashes($HTTP_POST_VARS['features'])."',
					comments='".add_slashes($HTTP_POST_VARS['comments'])."',
					certified='".add_slashes($HTTP_POST_VARS['certified'])."',
					special= '".$special."'
				WHERE id=".$HTTP_GET_VARS["id"];
 
		if(@mysql_query($sql))
			die(header("Location: index.php?status=update"));
		else
			$error_msg = "Record was not updated because of invalid data posted.<br>- Stock must be unique.";
	}
	else//if($error_msg == "")
		$error_msg = "Record was not updated because of invalid data posted.<br>".$error_msg;
 
	$member_name = $HTTP_POST_VARS["member_name"];
	$stock = $HTTP_POST_VARS["stock"];
	$stored_month = $HTTP_POST_VARS["stored_month"];
	$stored_day = $HTTP_POST_VARS["stored_day"];
	$stored_year = $HTTP_POST_VARS["stored_year"];
	$year = $HTTP_POST_VARS["year"];
	$model = $HTTP_POST_VARS["model"];
	$type = $HTTP_POST_VARS["type"];
	$engine = $HTTP_POST_VARS["engine"];
	$trans = $HTTP_POST_VARS["trans"];
	$drive = $HTTP_POST_VARS["drive"];
	$color = $HTTP_POST_VARS["color"];
	$millage = $HTTP_POST_VARS["millage"];
	$vin = $HTTP_POST_VARS["vin"];
	$price = $HTTP_POST_VARS["price"];
	$low = $HTTP_POST_VARS["low"];
	$high = $HTTP_POST_VARS["high"];
	$features = $HTTP_POST_VARS["features"];
	$comments = $HTTP_POST_VARS["comments"];
	$certified = $HTTP_POST_VARS["certified"];	
 
}
else
{
	$sql = "SELECT c.*,CONCAT(d.first_name,' ',d.last_name) AS dealer_name
	        FROM ".$db_prefix."cars AS c
			  INNER JOIN ".$db_prefix."dealers AS d ON d.id=c.member_id
	        WHERE c.id=".$HTTP_GET_VARS["id"];
	if($HTTP_SESSION_VARS['ses_adm_id']!=1)
	  $sql .= " AND c.member_id=".$HTTP_SESSION_VARS['ses_adm_id'];
 
	$rs = @mysql_query($sql) or trigger_error('Error on executing '.$sql, E_USER_ERROR);
 
	if(mysql_num_rows($rs)==0)
	  die(header("location: index.php"));
	list($id,
         $member_id,
         $stock,
	     $stored,
		  $year,
		 $model,
		 $type,
		 $engine,
		 $trans,
		 $drive,
		 $color,
		 $millage,
		 $vin,
		 $price,
		 $low,
		 $high,
		 $features,
		 $comments,
		 $certified,
		 $special,
		 $member_name) = mysql_fetch_array($rs);
		 list($stored_year,$stored_month,$stored_day) = explode("-",$stored);
}//else ($HTTP_SERVER_VARS['REQUEST_METHOD']=="POST")
 
if($HTTP_SESSION_VARS['ses_adm_id']==1)
{
   $sql_member="SELECT id,CONCAT(first_name,' ',last_name) AS name FROM ".$db_prefix."dealers ORDER BY name";
   $rs_member=mysql_query($sql_member)or 
		trigger_error('Error on executing '.$sql_member, E_USER_ERROR);
}
/****** OUTPUT *******/
include('../include/common_top.php');
?>
<script language="javascript" src="<?=$site_URL?>include/js/FormValidator.js"></script>
<script language="javascript">
var vArray=new Array();
vArray[vArray.length]=new Array('year','IsNotEmpty,IsNumber','Please enter a Year');
vArray[vArray.length]=new Array('model','IsNotEmpty','Please enter a Make');
vArray[vArray.length]=new Array('type','IsNotEmpty','Please enter a Model');
vArray[vArray.length]=new Array('engine','IsNotEmpty','Please enter an Engine');
vArray[vArray.length]=new Array('trans','IsNotEmpty','Please enter a Trans');
vArray[vArray.length]=new Array('drive','IsNotEmpty','Please enter a Drive');
vArray[vArray.length]=new Array('color','IsNotEmpty','Please enter a Color');
vArray[vArray.length]=new Array('millage','IsNotEmpty,IsNumber','Please enter a valid numeric value for Millage');
vArray[vArray.length]=new Array('price','IsMoney','Please enter a valid money value for Price');
vArray[vArray.length]=new Array('low','IsMoney','Please enter a valid money value for Low Book');
vArray[vArray.length]=new Array('high','IsMoney','Please enter s valid money value for High Book');
vArray[vArray.length]=new Array('certified','IsSelected','Please select an option for Certified');
</script>
 
<p class="title">Edit Car </p>
<?php if($error_msg!=""){?><p class="wrong"><?php echo $error_msg; ?></p><?php }?>
<?php if($msg!=""){?><p class="msg"><?php echo $msg; ?></p><?php }?>
<form name="f" method="post" action="edit.php?id=<?=$HTTP_GET_VARS['id']?>" onSubmit="return validate(this)">
<input type="Hidden" name="member_name" value="<?php echo $member_name ?>">
<table cellspacing="1" cellpadding="5" class="tbl">
	<tr><td colspan="2" class="tblhead">Car details</td></tr>
	<?php if($HTTP_SESSION_VARS['ses_adm_id']==1) {?>
	<tr> 
		<td class="tbltext">Dealer *</td> 
		<td class="tbltext" nowrap><?=$member_name ?></td> 
	</tr>
	<?php } ?>
	<tr> 
		<td class="tbltext">Stock *</td> 
		<td class="tbltext"><input type="hidden" name="stock" value="<?php echo replace_quotes($stock) ?>"><?php echo $stock ?></td> 
	</tr>
	<tr> 
		<td class="tbltext">Sored *</td> 
		<td class="tbltext">
		  <select name="stored_month" class="frm1" style="width:40px">
		    <?php 
			 for($i=1;$i<=12;$i++)
			 {
			    if($i<10)
				    $date_string = "0".$i;
				 else
				    $date_string = $i;
			 ?>
			    <option value="<?php echo $date_string ?>" <?php if($date_string == $stored_month) echo "selected" ?>><?php echo $date_string ?></option>
			 <?php } ?>
		  </select> /
		  <select name="stored_day" class="frm1" style="width:40px">
		    <?php 
			 for($i=1;$i<=31;$i++)
			 {
			    if($i<10)
				    $date_string = "0".$i;
				 else
				    $date_string = $i;
			 ?>
			    <option value="<?php echo $date_string ?>" <?php if($date_string == $stored_day) echo "selected" ?>><?php echo $date_string ?></option>
			 <?php } ?>
		  </select> /
		  <select name="stored_year" class="frm1" style="width:55px">
		    <?php 
			 for($i=date("Y")-15;$i<=date("Y")+5;$i++)
			 {
			    if($i<20)
				    $date_string = "0".$i;
				 else
				    $date_string = $i;
			 ?>
			    <option value="<?php echo $date_string ?>" <?php if($date_string == $stored_year) echo "selected" ?>><?php echo $date_string ?></option>
			 <?php } ?>
		  </select>
 
	   </td> 
	</tr>
	<tr> 
		<td class="tbltext">Year *</td> 
		<td class="tbltext"><input type="text" class="frm1" name="year" maxlength="4" value="<?php echo replace_quotes($year) ?>"></td> 
	</tr>
	<tr> 
		<td class="tbltext">Make *</td> 
		<td class="tbltext"><input type="text" class="frm1" name="model" value="<?php echo replace_quotes($model) ?>"></td> 
	</tr>
	<tr> 
		<td class="tbltext">Model *</td> 
		<td class="tbltext"><input type="text" class="frm1" name="type" value="<?php echo replace_quotes($type) ?>"></td> 
	</tr>
	<tr> 
		<td class="tbltext">Engine *</td> 
		<td class="tbltext"><input type="text" class="frm1" name="engine" value="<?php echo replace_quotes($engine) ?>"></td> 
	</tr>
	<tr> 
		<td class="tbltext">Trans *</td> 
		<td class="tbltext"><input type="text" class="frm1" name="trans" value="<?php echo replace_quotes($trans) ?>"></td> 
	</tr>
	<tr> 
		<td class="tbltext">Drive *</td> 
		<td class="tbltext"><input type="text" class="frm1" name="drive" value="<?php echo replace_quotes($drive) ?>"></td> 
	</tr>
	<tr> 
		<td class="tbltext">Color *</td> 
		<td class="tbltext"><input type="text" class="frm1" name="color" value="<?php echo replace_quotes($color) ?>"></td> 
	</tr>
	<tr> 
		<td class="tbltext">Millage *</td> 
		<td class="tbltext"><input type="text" class="frm1" name="millage" value="<?php echo replace_quotes($millage) ?>"></td> 
	</tr>
	<tr> 
		<td class="tbltext">VIN</td> 
		<td class="tbltext"><input type="text" class="frm1" name="vin" value="<?php echo replace_quotes($vin) ?>"></td> 
	</tr>
	<tr> 
		<td class="tbltext">Price</td> 
		<td class="tbltext"><input type="text" class="frm1" name="price" value="<?php if($price != "" && $price != "0"){ if(is_numeric($price)){ echo "$".number_format($price,2);}else{ echo $price; }}?>"></td> 
	</tr>
	<tr> 
		<td class="tbltext">Low Book</td> 
		<td class="tbltext"><input type="text" class="frm1" name="low" value="<?php if($low != "" && $low != "0"){ if(is_numeric($low)){ echo "$".number_format($low,2);}else{ echo $low; }}?>"></td> 
	</tr>
	<tr> 
		<td class="tbltext">High Book</td> 
		<td class="tbltext"><input type="text" class="frm1" name="high" value="<?php if($high != "" && $high != "0"){ if(is_numeric($high)){ echo "$".number_format($high,2);}else{ echo $high; }}?>"></td> 
	</tr>
	<tr> 
		<td class="tbltext" valign="top">Features</td> 
		<td class="tbltext"><textarea class="frm1" name="features" rows="7"><?php echo replace_quotes(str_replace("<br>","\n",$features)) ?></textarea></td> 
	</tr>
	<tr> 
		<td class="tbltext" valign="top">Comments</td> 
		<td class="tbltext"><textarea class="frm1" name="comments" rows="7"><?php echo replace_quotes($comments) ?></textarea></td> 
	</tr>
	<?php if($HTTP_SESSION_VARS['ses_adm_id']==1){?>
	<tr> 
		<td class="tbltext">Special</td> 
		<td class="tbltext"><input type="checkbox" name="special" value="Y" <?php if($special == "Y")echo "checked"?>></td> 
	</tr>	
	<?php }?>
	<tr> 
		<td class="tbltext">Certified *</td> 
		<td class="tbltext" nowrap>
			<select name="certified" class="frm1" style="width:267px">
			  <option value="0" <?php if($certified == "0") echo 'selected'; ?>>Please Select</option>			
			  <option value="no" <?php if($certified == "no") echo 'selected'; ?>>No</option>			
			  <option value="yes" <?php if($certified == "yes") echo 'selected'; ?>>Yes</option>			
			</select>			
		</td> 
	</tr>
	<tr><td class="tbltext" colspan="2" align="center"><input type="submit" name="submit" value="Update" class="button"></td></tr>
</table>
<p class="text"><a href="http://www.garagetoto.com/search/cession_pdf.php">certificat de cession </a></p>
</form>
<p class="text"><a href="javascript:history.back()">Back</a></p>
 
<?php include("../include/common_bottom.php"); ?>
Voili, voilou, merci de votre aide !
gator est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 16/06/2006, 18h13   #6
Membre chevronné
 
Avatar de gerald2545
 
Inscription : février 2003
Messages : 643
Détails du profil
Informations forums :
Inscription : février 2003
Messages : 643
Points : 660
Points : 660
et fdf toolkit tu l'as trouvé où en fin de compte?
gerald2545 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 17/06/2006, 09h53   #7
Candidat au titre de Membre du Club
 
Inscription : mars 2006
Messages : 89
Détails du profil
Informations forums :
Inscription : mars 2006
Messages : 89
Points : 10
Points : 10
Par défaut pas besoin

je me suis servi du script trouvé sur la page que bkill m'as indiqué en lien :

Code :
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
<?php
 
// the full http path to the PDF form
$form = 'http://my_domain.com/my_pdf_form.pdf';
 
function create_fdf ($pdffile, $strings, $keys)
{
   $fdf = "%FDF-1.2\n%&#65533;&#65533;&#65533;&#65533;\n";
   $fdf .= "1 0 obj \n<< /FDF << /Fields [\n";
 
   foreach ($strings as $key => $value)
   {
       $key = addcslashes($key, "\n\r\t\\()");
       $value = addcslashes($value, "\n\r\t\\()");
       $fdf .= "<< /T ($key) /V ($value) >> \n";
   }
   foreach ($keys as $key => $value)
   {
       $key = addcslashes($key, "\n\r\t\\()");
       $fdf .= "<< /T ($key) /V /$value >> \n";
   }
 
   $fdf .= "]\n/F ($pdffile) >>";
   $fdf .= ">>\nendobj\ntrailer\n<<\n";
   $fdf .= "/Root 1 0 R \n\n>>\n";
   $fdf .= "%%EOF";
 
   return $fdf;
}
 
// Fill in text fields
$strings = array(
   'date' => '10/17/2004',
   'full_name' => 'Joe Doe',
   'phone_num' => '123-4567',
   'company' => 'ACME Widgets',
   'amount' => 'USD 100.00'
   );
 
// Fill in check boxes/radio buttons
$keys = array('
   gender' => 'male',//radio button
   'is_adult' => 'Off',//checkbox
   'urgent' => 'On'//checkbox
   );
 
// Output the PDF form, with form data filled-in
header('Content-type: application/vnd.fdf');
echo create_fdf($form, $strings, $keys);
 
?>
Et c'est tout bon !
gator est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 17/06/2006, 13h31   #8
Candidat au titre de Membre du Club
 
Inscription : mars 2006
Messages : 89
Détails du profil
Informations forums :
Inscription : mars 2006
Messages : 89
Points : 10
Points : 10
Par défaut probléme de récupération de variables pour sortie en pdf

probléme de récupération de variables pour sortie en pdf

J'ai mon fichier edit.php qui rapelle les infos du véhicule, a la fin, je veux quand cliquant sur " cession", ce dernier apelle le fichier cession_pdf.php, et celui ci me ressort les infos dans un fichier pdf.

Probléme, il génére le certificat de cession en pdf, mais prend les infos saisies dans mon fichier cession_pdf.php

Je voudrais, dans mon fichier cession_pdf.php, pouvoir récupérer mes variables !
Code :
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
<?php
 
// adresse ou se trouve le fichier pdf
$form = 'http://www.garagetoto.com/search/cession.pdf';
 
 
function create_fdf ($pdffile, $strings, $keys)
{
   $fdf = "%FDF-1.2\n%????\n";
   $fdf .= "1 0 obj \n<< /FDF << /Fields [\n";
 
   foreach ($strings as $key => $value)
   {
       $key = addcslashes($key, "\n\r\t\\()");
       $value = addcslashes($value, "\n\r\t\\()");
       $fdf .= "<< /T ($key) /V ($value) >> \n";
   }
   foreach ($keys as $key => $value)
   {
       $key = addcslashes($key, "\n\r\t\\()");
       $fdf .= "<< /T ($key) /V /$value >> \n";
   }
 
   $fdf .= "]\n/F ($pdffile) >>";
   $fdf .= ">>\nendobj\ntrailer\n<<\n";
   $fdf .= "/Root 1 0 R \n\n>>\n";
   $fdf .= "%%EOF";
 
   return $fdf;
}
 
// listage des champs
$strings = array(
   'nom1' => 'garagetoto',
   'nom2' => '',
   'adresse' => 'ZA LE PRE DROUE',
   'codepostal' => '88150',
   'ville' => 'CHAVELOT',
   'jour' => '16',
   'mois' => '06',
   'année' => '2006',
   'numéroimmatriculation' => '6455VE88',
   'J1' => 'VP',
   'D1' => 'VOLKSWAGEN',
   'D2' => 'GBC8KT',
   'E' => '$vin',
   'J3' => 'FG4521',
   'P6' => '06',
   'Bjour' => '12',
   'Bmois' => '09',
   'Bannée' => '1999',
   'anomprénom' => 'GERARD LENORMAND',
   'adresse1' => '14 RUE DE LA PIE QUI CHANTE',
   'codeposta1' => '54000',
   'ville1' => 'NETLAND',
   'destruction' => '',
   'lieu' => 'CHAVELOT',
   'date' => '16/06/2006'
   );
 
// listage des  cases a cocher / boutons radios
$keys = array('
   gender' => 'male',// bouton radio
   'transformation' => 'on',// case a cocher 
   'vendu' => 'on',// case a cocher 
   'urgent' => 'On'// case a cocher 
   );
 
// Output  
header('Content-type: application/vnd.fdf');
echo create_fdf($form, $strings, $keys);
 
?>
Pour tester le probléme en ligne :

adresse: http://www.garagetoto/search/member/
login: test
pass: pass
Une fois rentré, cliquez sur " vehicle admin ", le véhicule de test apparait.
Cliquez sur "edit", le detail apparait.

Si vous cliquez en bas sur cession, il génére le certificat de cession en pdf, mais prend les infos saisies dans mon fichier cession_pdf.php.

J'ai simplement rensigné une variable( le numéro de série du véhicule), il m'affiche $vin a la place !

J'ai les boules...


Merci de votre aide.
gator est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 17/06/2006, 21h59   #9
Membre chevronné
 
Avatar de gerald2545
 
Inscription : février 2003
Messages : 643
Détails du profil
Informations forums :
Inscription : février 2003
Messages : 643
Points : 660
Points : 660
je veux bien essayer de t'aider mais tes identifiants ne permettent pas d'accéder à ta page....
gerald2545 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 18/06/2006, 12h17   #10
Membre régulier
 
Inscription : mai 2005
Messages : 120
Détails du profil
Informations personnelles :
Âge : 27

Informations forums :
Inscription : mai 2005
Messages : 120
Points : 98
Points : 98
Salut,

essaie déjà de remplacer
par
à condition que l'action de ton formulaire renvoie vers cession_pdf.php
Ouark est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 19/06/2006, 09h58   #11
Candidat au titre de Membre du Club
 
Inscription : mars 2006
Messages : 89
Détails du profil
Informations forums :
Inscription : mars 2006
Messages : 89
Points : 10
Points : 10
Par défaut Récupération de la moitié des variables php

merci des coups de mains.

j'ai un code qui me récupére dans la base les infos d'un véhicule, dans la foulée, ces infos sont envoyées dans un pdf qui s'affiche à l'écran.

Mon probléme est le suivant, le pdf est bien généré, mais je récupére seulement les variables suivantes :

'Bjour' => $stored_day,
'Bmois' => $stored_month,
'Bannee' => $stored_year,
'D1' => $model,
'E' => $vin,


Je ne récupére rien d'autre...



Voci mon code :
Code :
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
<?php
 
 
include('../../include/ErrorHandler/error_handler.php');
include('../../include/global.php');
include('../include/auth.php');
include('../../include/connection.php');
include('../../include/functions.php');
include('../../include/validation.php');
 
if(!isset($HTTP_GET_VARS["id"]) || $HTTP_GET_VARS["id"]=="")
        die(header('location: index.php'));
 
 
$error_msg = "";
$msg = "";
if($HTTP_SERVER_VARS['REQUEST_METHOD']=="POST") 
{
	/**** SERVER VALIDATION ****/
	if(!(chk($HTTP_POST_VARS['year'],"IsNotEmpty,IsNumber")))
	    $error_msg.= "- Please enter a Year<br>";
	if(!(chk($HTTP_POST_VARS['model'],"IsNotEmpty")))
	    $error_msg.= "- Please enter a Make<br>";
	if(!(chk($HTTP_POST_VARS['type'],"IsNotEmpty")))
	    $error_msg.= "- Please enter a Model<br>";
	if(!(chk($HTTP_POST_VARS['engine'],"IsNotEmpty")))
	    $error_msg.= "- Please enter an Engine<br>";
	if(!(chk($HTTP_POST_VARS['trans'],"IsNotEmpty")))
	    $error_msg.= "- Please enter a Trans<br>";
	if(!(chk($HTTP_POST_VARS['drive'],"IsNotEmpty")))
	    $error_msg.= "- Please enter a Drive<br>";
	if(!(chk($HTTP_POST_VARS['color'],"IsNotEmpty")))
	    $error_msg.= "- Please enter a Color<br>";
	if(!(chk($HTTP_POST_VARS['millage'],"IsNotEmpty,IsNumber")))
	    $error_msg.= "- Please enter a valid numeric value for Mileage<br>";
	if(!(chk($HTTP_POST_VARS['price'],"IsMoney")))
	    $error_msg.= "- Please enter a valid money value for Price<br>";
	/*
	if(!(chk($HTTP_POST_VARS['low'],"IsMoney")))
	    $error_msg.= "- Please enter a valid money value for Low Book<br>";
	if(!(chk($HTTP_POST_VARS['high'],"IsMoney")))
	    $error_msg.= "- Please enter a valid money value for High Book<br>";
	*/
	if(!(chk($HTTP_POST_VARS['certified'],"IsSelected")))
		$error_msg.= "- Please select an option for Certified<br>";
 
	if(isset($HTTP_POST_VARS['special']))
		$special="Y";
	else
		$special="N";
	if($error_msg == "") 
	{
		#############################################################################
		#	IF MAGIC QUOTE IN PHP.INI IS SET OFF ADD SLASHES TO SUBMITED VARIABLES	#
		#############################################################################
		$sql = "UPDATE ".$db_prefix."cars SET
					stored='".$HTTP_POST_VARS['stored_year']."-".$HTTP_POST_VARS['stored_month']."-".$HTTP_POST_VARS['stored_day']."',
					year='".add_slashes($HTTP_POST_VARS['year'])."',
					model='".add_slashes($HTTP_POST_VARS['model'])."',
					type='".add_slashes($HTTP_POST_VARS['type'])."',
					engine='".add_slashes($HTTP_POST_VARS['engine'])."',
					trans='".add_slashes($HTTP_POST_VARS['trans'])."',
					drive='".add_slashes($HTTP_POST_VARS['drive'])."',
					color='".add_slashes($HTTP_POST_VARS['color'])."',
					millage='".add_slashes($HTTP_POST_VARS['millage'])."',
					vin='".add_slashes($HTTP_POST_VARS['vin'])."',
					price='".add_slashes(strip_out($HTTP_POST_VARS['price']))."',
					low='".add_slashes(strip_out($HTTP_POST_VARS['low']))."',
					high='".add_slashes(strip_out($HTTP_POST_VARS['high']))."',
					features='".add_slashes($HTTP_POST_VARS['features'])."',
					comments='".add_slashes($HTTP_POST_VARS['comments'])."',
					certified='".add_slashes($HTTP_POST_VARS['certified'])."',
					special= '".$special."',
					datedevente='".$HTTP_POST_VARS['datedevente_year']."-".$HTTP_POST_VARS['datedevente_month']."-".$HTTP_POST_VARS['datedevente_day']."',
					immatriculation='".add_slashes($HTTP_POST_VARS['immatriculation'])."',
                    typeduvehicule='".add_slashes($HTTP_POST_VARS['typeduvehicule'])."',
                    genre='".add_slashes($HTTP_POST_VARS['genre'])."',
                    carrosserie='".add_slashes($HTTP_POST_VARS['carrosserie'])."',
                    cv='".add_slashes($HTTP_POST_VARS['cv'])."',
                    kms_certifies='".add_slashes($HTTP_POST_VARS['kms_certifies'])."',
                    nom_acheteur='".add_slashes($HTTP_POST_VARS['nom_acheteur'])."',
                    adresse_acheteur='".add_slashes($HTTP_POST_VARS['adresse_acheteur'])."',
                    cp_acheteur='".add_slashes($HTTP_POST_VARS['cp_acheteur'])."',
                    ville_acheteur='".add_slashes($HTTP_POST_VARS['ville_acheteur'])."'
				WHERE id=".$HTTP_GET_VARS["id"];
 
		if(@mysql_query($sql))
			die(header("Location: index.php?status=update"));
		else
			$error_msg = "Record was not updated because of invalid data posted.<br>- Stock must be unique.";
	}
	else//if($error_msg == "")
		$error_msg = "Record was not updated because of invalid data posted.<br>".$error_msg;
 
	$member_id = $HTTP_POST_VARS["member_id"];
	$stock = $HTTP_POST_VARS["stock"];
	$stored_month = $HTTP_POST_VARS["stored_month"];
	$stored_day = $HTTP_POST_VARS["stored_day"];
	$stored_year = $HTTP_POST_VARS["stored_year"];
	$year = $HTTP_POST_VARS["year"];
	$model = $HTTP_POST_VARS["model"];
	$type = $HTTP_POST_VARS["type"];
	$engine = $HTTP_POST_VARS["engine"];
	$trans = $HTTP_POST_VARS["trans"];
	$drive = $HTTP_POST_VARS["drive"];
	$color = $HTTP_POST_VARS["color"];
	$millage = $HTTP_POST_VARS["millage"];
	$vin = $HTTP_POST_VARS["vin"];
	$price = $HTTP_POST_VARS["price"];
	$low = $HTTP_POST_VARS["low"];
	$high = $HTTP_POST_VARS["high"];
	$features = $HTTP_POST_VARS["features"];
	$comments = $HTTP_POST_VARS["comments"];
	$certified = $HTTP_POST_VARS["certified"];	
	$datedevente_month = $HTTP_POST_VARS["datedevente_month"];
    $datedevente_day = $HTTP_POST_VARS["datedevente_day"];
    $datedevente_year = $HTTP_POST_VARS["datedevente_year"];
	$immatriculation = $HTTP_POST_VARS["immatriculation"];
   $typeduvehicule = $HTTP_POST_VARS["typeduvehicule"];
   $genre = $HTTP_POST_VARS["genre"];
   $carrosserie = $HTTP_POST_VARS["carrosserie"];
   $cv = $HTTP_POST_VARS["cv"];
   $kms_certifies = $HTTP_POST_VARS["kms_certifies"];
   $nom_acheteur = $HTTP_POST_VARS["nom_acheteur "];
   $adresse_acheteur = $HTTP_POST_VARS["adresse_acheteur "];
   $cp_acheteur = $HTTP_POST_VARS["cp_acheteur"];
   $ville_acheteur = $HTTP_POST_VARS["ville_acheteur"];
   }
else
{
	$sql = "SELECT * FROM ".$db_prefix."cars 
	        WHERE id=".$HTTP_GET_VARS["id"]." 
			AND member_id=".$HTTP_SESSION_VARS['ses_mem_id'];
 
	$rs = @mysql_query($sql) or trigger_error('Error on executing '.$sql, E_USER_ERROR);
 
	if(mysql_num_rows($rs)==0)
	  die(header("location: index.php"));
	list($id,
         $member_id,
         $stock,
	     $stored,
		  $year,
		 $model,
		 $type,
		 $engine,
		 $trans,
		 $drive,
		 $color,
		 $millage,
		 $vin,
		 $price,
		 $low,
		 $high,
		 $features,
		 $comments,
		 $certified,
		 $special) = mysql_fetch_array($rs);
		 list($stored_year,$stored_month,$stored_day) = explode("-",$stored);
		 list($datedevente_year,$datedevente_month,$datedevente_day) = explode("-",$datedevente);
		 $typeduvehicule;
	     $genre;
		 $carrosserie;
		 $cv;
		 $kms_certifies;
	     $nom_acheteur ;
		 $adresse_acheteur ;
		 $cp_acheteur;
		 $ville_acheteur ;			 
 
}
// adresse ou se trouve le fichier pdf
$form = 'http://www.garagetoto.com/search/cession.pdf';
 
function create_fdf ($pdffile, $strings, $keys)
{
   $fdf = "%FDF-1.2\n%????\n";
   $fdf .= "1 0 obj \n<< /FDF << /Fields [\n";
 
   foreach ($strings as $key => $value)
   {
       $key = addcslashes($key, "\n\r\t\\()");
       $value = addcslashes($value, "\n\r\t\\()");
       $fdf .= "<< /T ($key) /V ($value) >> \n";
   }
   foreach ($keys as $key => $value)
   {
       $key = addcslashes($key, "\n\r\t\\()");
       $fdf .= "<< /T ($key) /V /$value >> \n";
   }
 
   $fdf .= "]\n/F ($pdffile) >>";
   $fdf .= ">>\nendobj\ntrailer\n<<\n";
   $fdf .= "/Root 1 0 R \n\n>>\n";
   $fdf .= "%%EOF";
 
   return $fdf;
}
 
// listage  
$strings = array(
   'nom1' => 'garagetoto',
   'nom2' => '',
   'adresse' => 'ZA LE PRE DROUE',
   'codepostal' => '88150',
   'ville' => 'CHAVELOT',
   'Bjour' => $stored_day,
   'Bmois' => $stored_month,
   'Bannee' => $stored_year,
   'D1' => $model,
   'E' => $vin,
   'numeroimmatriculation' => $immatriculation,
   'D2' => $typeduvehicule,
   'J1' => $genre,
    'J3' => $carrosserie,
    'P6' => $cv,
	'anomprénom' => $nom_acheteur,
   'adresse1' => $adresse_acheteur,
   'codepostal1' => $cp_acheteur,
   'ville1' => $ville_acheteur,
    'lieu' => 'CHAVELOT',
   'date' => '16/06/2006'
     );
 
// listage des  cases a cocher / boutons radios
$keys = array('
   gender' => 'male',// bouton radio
   'transformation' => 'on',// case a cocher 
   'vendu' => 'on',// case a cocher 
   'urgent' => 'On'// case a cocher 
   );
 
// Output  du formulaire
header('Content-type: application/vnd.fdf');
echo create_fdf($form, $strings, $keys);
 
?>
Merci pour votre aide
gator est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 13h07.


 
 
 
 
Partenaires

Hébergement Web