This is the code for another existing table in my fpdf. For my new table, I'd like to keep the aesthetics the same as this but present the different information above:
case "indexpagestable":
$cellwidth = ((PAGEWIDTH - (PAGEMARGIN * 2)) * PDF_SCALING) / 6;
$fontsize = 14;
$pdf->SetDrawColor(255, 255, 255);
$pdf->SetFillColor(192, 80, 77);
$pdf->SetTextColor(255, 255, 255);
$pdf->Cell($cellwidth * 2, $fontsize, "", 0, 0, "L");
$pdf->Cell($cellwidth, $fontsize, "Google", 1, 0, "C", true);
$pdf->Cell($cellwidth, $fontsize, "Yahoo", 1, 0, "C", true);
$pdf->Cell($cellwidth, $fontsize, "MSN", 1, 1, "C", true);
$pdf->SetDrawColor(255, 255, 255);
$pdf->SetFillColor(223, 167, 167);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell($cellwidth, $fontsize, "", 0, 0, "L");
$pdf->Cell($cellwidth, 14, "Index Pages", 0, 0, "C");
$pdf->SetTextColor(255, 255, 255);
$pdf->Cell($cellwidth, $fontsize, $values["googleindexed"], 1, 0, "C", true);
$pdf->Cell($cellwidth, $fontsize, $values["yahooindexed"], 1, 0, "C", true);
$pdf->Cell($cellwidth, $fontsize, $values["msnindexed"], 1, 1, "C", true);
$pdf->SetDrawColor(0, 0, 0);
$pdf->SetTextColor(0, 0, 0);
break;
And this is the code for collecting the data into the table:
<td >Competitors<br /><br />
Keywords</td>
<td><input value="<?php echo($_POST['c1']); ?>" type="text" name="c1" /></td>
<td><input value="<?php echo($_POST['c2']); ?>" type="text" name="c2" /></td>
<td><input value="<?php echo($_POST['c3']); ?>" type="text" name="c3" /></td>
<td><input value="<?php echo($_POST['c4']); ?>" type="text" name="c4" /></td>
<td><input value="<?php echo($_POST['c5']); ?>" type="text" name="c5" /></td>
<td><input value="<?php echo($_POST['c6']); ?>" type="text" name="c6" /></td>
<td><input value="<?php echo($_POST['c7']); ?>" type="text" name="c7" /></td>
<td><input value="<?php echo($_POST['c8']); ?>" type="text" name="c8" /></td>
<td><input value="<?php echo($_POST['c9']); ?>" type="text" name="c9" /></td>
<td><input value="<?php echo($_POST['c10']); ?>" type="text" name="c10" /></td>
</tr>
<tr>
<td width="50"><input value="<?php echo($_POST['k1']); ?>" type="text" name="k1" id="k1"/></td>
<td><input value="<?php echo($_POST['k1d1']); ?>" type="text" name="k1d1" /></td>
<td><input value="<?php echo($_POST['k1d2']); ?>" type="text" name="k1d2" /></td>
<td><input value="<?php echo($_POST['k1d3']); ?>" type="text" name="k1d3" /></td>
<td><input value="<?php echo($_POST['k1d4']); ?>" type="text" name="k1d4" /></td>
<td><input value="<?php echo($_POST['k1d5']); ?>" type="text" name="k1d5" /></td>
<td><input value="<?php echo($_POST['k1d6']); ?>" type="text" name="k1d6" /></td>
<td><input value="<?php echo($_POST['k1d7']); ?>" type="text" name="k1d7" /></td>
<td><input value="<?php echo($_POST['k1d8']); ?>" type="text" name="k1d8" /></td>
<td><input value="<?php echo($_POST['k1d9']); ?>" type="text" name="k1d9" /></td>
<td><input value="<?php echo($_POST['k1d10']); ?>" type="text" name="k1d10" /></td>
</tr>
<tr>
<td><input value="<?php echo($_POST['k2']); ?>" type="text" name="k2" id="k2"/></td>
<td><input value="<?php echo($_POST['k2d1']); ?>" type="text" name="k2d1" /></td>
<td><input value="<?php echo($_POST['k2d2']); ?>" type="text" name="k2d2" /></td>
<td><input value="<?php echo($_POST['k2d3']); ?>" type="text" name="k2d3" /></td>
<td><input value="<?php echo($_POST['k2d4']); ?>" type="text" name="k2d4" /></td>
<td><input value="<?php echo($_POST['k2d5']); ?>" type="text" name="k2d5" /></td>
<td><input value="<?php echo($_POST['k2d6']); ?>" type="text" name="k2d6" /></td>
<td><input value="<?php echo($_POST['k2d7']); ?>" type="text" name="k2d7" /></td>
<td><input value="<?php echo($_POST['k2d8']); ?>" type="text" name="k2d8" /></td>
<td><input value="<?php echo($_POST['k2d9']); ?>" type="text" name="k2d9" /></td>
<td><input value="<?php echo($_POST['k2d10']); ?>" type="text" name="k2d10" /></td>
</tr>
<tr>
<td><input value="<?php echo($_POST['k3']); ?>" type="text" name="k3" id="k3"/></td>
<td><input value="<?php echo($_POST['k3d1']); ?>" type="text" name="k3d1" /></td>
<td><input value="<?php echo($_POST['k3d2']); ?>" type="text" name="k3d2" /></td>
<td><input value="<?php echo($_POST['k3d3']); ?>" type="text" name="k3d3" /></td>
<td><input value="<?php echo($_POST['k3d4']); ?>" type="text" name="k3d4" /></td>
<td><input value="<?php echo($_POST['k3d5']); ?>" type="text" name="k3d5" /></td>
<td><input value="<?php echo($_POST['k3d6']); ?>" type="text" name="k3d6" /></td>
<td><input value="<?php echo($_POST['k3d7']); ?>" type="text" name="k3d7" /></td>
<td><input value="<?php echo($_POST['k3d8']); ?>" type="text" name="k3d8" /></td>
<td><input value="<?php echo($_POST['k3d9']); ?>" type="text" name="k3d9" /></td>
<td><input value="<?php echo($_POST['k3d10']); ?>" type="text" name="k3d10" /></td>
</tr>
<tr>
<td><input value="<?php echo($_POST['k4']); ?>" type="text" name="k4" id="k4"/></td>
<td><input value="<?php echo($_POST['k4d1']); ?>" type="text" name="k4d1" /></td>
<td><input value="<?php echo($_POST['k4d2']); ?>" type="text" name="k4d2" /></td>
<td><input value="<?php echo($_POST['k4d3']); ?>" type="text" name="k4d3" /></td>
<td><input value="<?php echo($_POST['k4d4']); ?>" type="text" name="k4d4" /></td>
<td><input value="<?php echo($_POST['k4d5']); ?>" type="text" name="k4d5" /></td>
<td><input value="<?php echo($_POST['k4d6']); ?>" type="text" name="k4d6" /></td>
<td><input value="<?php echo($_POST['k4d7']); ?>" type="text" name="k4d7" /></td>
<td><input value="<?php echo($_POST['k4d8']); ?>" type="text" name="k4d8" /></td>
<td><input value="<?php echo($_POST['k4d9']); ?>" type="text" name="k4d9" /></td>
<td><input value="<?php echo($_POST['k4d10']); ?>" type="text" name="k4d10" /></td>
</tr>
<tr>
<td><input value="<?php echo($_POST['k5']); ?>" type="text" name="k5" id="k5"/></td>
<td><input value="<?php echo($_POST['k5d1']); ?>" type="text" name="k5d1" /></td>
<td><input value="<?php echo($_POST['k5d2']); ?>" type="text" name="k5d2" /></td>
<td><input value="<?php echo($_POST['k5d3']); ?>" type="text" name="k5d3" /></td>
<td><input value="<?php echo($_POST['k5d4']); ?>" type="text" name="k5d4" /></td>
<td><input value="<?php echo($_POST['k5d5']); ?>" type="text" name="k5d5" /></td>
<td><input value="<?php echo($_POST['k5d6']); ?>" type="text" name="k5d6" /></td>
<td><input value="<?php echo($_POST['k5d7']); ?>" type="text" name="k5d7" /></td>
<td><input value="<?php echo($_POST['k5d8']); ?>" type="text" name="k5d8" /></td>
<td><input value="<?php echo($_POST['k5d9']); ?>" type="text" name="k5d9" /></td>
<td><input value="<?php echo($_POST['k5d10']); ?>" type="text" name="k5d10" /></td>
</tr>
<tr>
<td><input value="<?php echo($_POST['k6']); ?>" type="text" name="k6" id="k6"/></td>
<td><input value="<?php echo($_POST['k6d1']); ?>" type="text" name="k6d1" /></td>
<td><input value="<?php echo($_POST['k6d2']); ?>" type="text" name="k6d2" /></td>
<td><input value="<?php echo($_POST['k6d3']); ?>" type="text" name="k6d3" /></td>
<td><input value="<?php echo($_POST['k6d4']); ?>" type="text" name="k6d4" /></td>
<td><input value="<?php echo($_POST['k6d5']); ?>" type="text" name="k6d5" /></td>
<td><input value="<?php echo($_POST['k6d6']); ?>" type="text" name="k6d6" /></td>
<td><input value="<?php echo($_POST['k6d7']); ?>" type="text" name="k6d7" /></td>
<td><input value="<?php echo($_POST['k6d8']); ?>" type="text" name="k6d8" /></td>
<td><input value="<?php echo($_POST['k6d9']); ?>" type="text" name="k6d9" /></td>
<td><input value="<?php echo($_POST['k6d10']); ?>" type="text" name="k6d10" /></td>
</tr>
<tr>
<td><input value="<?php echo($_POST['k7']); ?>" type="text" name="k7" id="k7"/></td>
<td><input value="<?php echo($_POST['k7d1']); ?>" type="text" name="k7d1" /></td>
<td><input value="<?php echo($_POST['k7d2']); ?>" type="text" name="k7d2" /></td>
<td><input value="<?php echo($_POST['k7d3']); ?>" type="text" name="k7d3" /></td>
<td><input value="<?php echo($_POST['k7d4']); ?>" type="text" name="k7d4" /></td>
<td><input value="<?php echo($_POST['k7d5']); ?>" type="text" name="k7d5" /></td>
<td><input value="<?php echo($_POST['k7d6']); ?>" type="text" name="k7d6" /></td>
<td><input value="<?php echo($_POST['k7d7']); ?>" type="text" name="k7d7" /></td>
<td><input value="<?php echo($_POST['k7d8']); ?>" type="text" name="k7d8" /></td>
<td><input value="<?php echo($_POST['k7d9']); ?>" type="text" name="k7d9" /></td>
<td><input value="<?php echo($_POST['k7d10']); ?>" type="text" name="k7d10" /></td>
</tr>
<tr>
<td><input value="<?php echo($_POST['k8']); ?>" type="text" name="k8" id="k8"/></td>
<td><input value="<?php echo($_POST['k8d1']); ?>" type="text" name="k8d1" /></td>
<td><input value="<?php echo($_POST['k8d2']); ?>" type="text" name="k8d2" /></td>
<td><input value="<?php echo($_POST['k8d3']); ?>" type="text" name="k8d3" /></td>
<td><input value="<?php echo($_POST['k8d4']); ?>" type="text" name="k8d4" /></td>
<td><input value="<?php echo($_POST['k8d5']); ?>" type="text" name="k8d5" /></td>
<td><input value="<?php echo($_POST['k8d6']); ?>" type="text" name="k8d6" /></td>
<td><input value="<?php echo($_POST['k8d7']); ?>" type="text" name="k8d7" /></td>
<td><input value="<?php echo($_POST['k8d8']); ?>" type="text" name="k8d8" /></td>
<td><input value="<?php echo($_POST['k8d9']); ?>" type="text" name="k8d9" /></td>
<td><input value="<?php echo($_POST['k8d10']); ?>" type="text" name="k8d10" /></td>
</tr>
<tr>
<td><input value="<?php echo($_POST['k9']); ?>" type="text" name="k9" id="k9"/></td>
<td><input value="<?php echo($_POST['k9d1']); ?>" type="text" name="k9d1" /></td>
<td><input value="<?php echo($_POST['k9d2']); ?>" type="text" name="k9d2" /></td>
<td><input value="<?php echo($_POST['k9d3']); ?>" type="text" name="k9d3" /></td>
<td><input value="<?php echo($_POST['k9d4']); ?>" type="text" name="k9d4" /></td>
<td><input value="<?php echo($_POST['k9d5']); ?>" type="text" name="k9d5" /></td>
<td><input value="<?php echo($_POST['k9d6']); ?>" type="text" name="k9d6" /></td>
<td><input value="<?php echo($_POST['k9d7']); ?>" type="text" name="k9d7" /></td>
<td><input value="<?php echo($_POST['k9d8']); ?>" type="text" name="k9d8" /></td>
<td><input value="<?php echo($_POST['k9d9']); ?>" type="text" name="k9d9" /></td>
<td><input value="<?php echo($_POST['k9d10']); ?>" type="text" name="k9d10" /></td>
</tr>
<tr>
<td><input value="<?php echo($_POST['k10']); ?>" type="text" name="k10" id="k10"/></td>
<td><input value="<?php echo($_POST['k10d1']); ?>" type="text" name="k10d1" /></td>
<td><input value="<?php echo($_POST['k10d2']); ?>" type="text" name="k10d2" /></td>
<td><input value="<?php echo($_POST['k10d3']); ?>" type="text" name="k10d3" /></td>
<td><input value="<?php echo($_POST['k10d4']); ?>" type="text" name="k10d4" /></td>
<td><input value="<?php echo($_POST['k10d5']); ?>" type="text" name="k10d5" /></td>
<td><input value="<?php echo($_POST['k10d6']); ?>" type="text" name="k10d6" /></td>
<td><input value="<?php echo($_POST['k10d7']); ?>" type="text" name="k10d7" /></td>
<td><input value="<?php echo($_POST['k10d8']); ?>" type="text" name="k10d8" /></td>
<td><input value="<?php echo($_POST['k10d9']); ?>" type="text" name="k10d9" /></td>
<td><input value="<?php echo($_POST['k10d10']); ?>" type="text" name="k10d10" /></td>
</tr>
</table>
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:
by: Ray_PaseurPosted on 2009-07-04 at 10:14:23ID: 24777390
Not sure I understand how best to answer this question, but I will try to provide some guidance. This is a fairly substantial application development project. Nothing is very "hard" - it is just a lot of code that needs to be written and tested. The general logic flow would be like this:
1. Query the data base. Get the values for all the fields in the table (if any) from the data base.
2. Present the table in a form to receive client input. The form fields are prepopulated with whatever you found in the data base.
3. Receive the form in $_POST, validate its contents, handle errors, update the data base with the new client input.
4. Use the validated fields that you have just put into the data base to create the FPDF object.
The look and feel of the table on the client screen is going to be controlled by HTML table, tr, td and styled by CSS. The look and feel of the PDF file is going to be controlled by your positioning statements that you send to FPDF. As far as I know there is no generalized way to turn HTML tables and CSS into a set of FPDF commands.
In using FPDF, I have found it useful to use variables or define() constants for all the color numbers and positioning elements. Since colors are somewhat dependent on the printer, and since you can adjust positions to about 1/100 inch, being able to tinker with these fields is important to getting a good final output.
HTH, ~Ray