grafische submit knop
Ik wil graag een grafische weergave op knoppen hebben, met name de submit knop.
voorbeeld :
<input type="submit" name = "submit" value="volgende">
Dit vang ik op in het php script :
if($_POST["submit"] == "volgende")
Als ik dan probeer :
<input type="image" src="next.gif" name="submit" value="volgende">
Dan krijg ik coordinaten binnen het gif plaatje, en dat wil ik niet.
Wie geeft my een duwtje in de goede richting ?
m.vr.gr
Cornelis
Bij een <input type="image" /> kun je geen value opgeven (correct me if I'm wrong). En het is standaard dat de coördinaten worden gepost. Om te controleren of er gepost is kun je nu (en sowieso altijd) beter dit gebruiken:
het type in een input veld is gewoon een aanduiding over wat voor formulier onderdeel het is.
je kan iig kiezen uit
text invoervelden
submit button
file plaatje uploaden
succes met googelen ;)
<input type=text name=zoekterm>
<INPUT TYPE="image" SRC="content/icons/zoom.png" ALT="Klik om de informatie te verzenden" VALUE="zoeken" NAME="action">
=>
zoekterm=test&action.x=6&action.y=8&action=zoeken
Crispijn schreef op 24.02.2007 16:38:
je kan dit prima met css oplossen. Bgr gewoon als plaatje instellen.
Note dat dit niet werkt in Safari of Camino (of speciale firefox-builds) op Mac OS X, en waarschijnlijk ook niet met alle andere browsers.
Bedankt voor de toevoeging! :D
Wil je een $_GET middels een plaatje doen, of gaat het op het controleren van een formulier ?
Je kunt dus niet met een value checken of je formulier gesubmit is. Gebruik daarom deze manier, die werkt altijd:
Code (php)
1
2
3
4
5
2
3
4
5
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// doe iets met de waarden uit het formulier
}
?>
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// doe iets met de waarden uit het formulier
}
?>
<input type="submit" name="submit" value="FIRST">
<input type="submit" name="submit" value="PREV">
<input type="submit" name="submit" value="NEXT">
<input type="submit" name="submit" value="LAST">
In het zelfde script (vooraan) vang ik de buttons op :
if($_POST["submit"] == "FIRST")
etcetera.
Maar nu wil ik allemaal grafische plaatjes op de knoppen, de platjes maak ik zo aan met Paint Shop Pro, opslaan als gif. Maar hoe dan verder ?
Cornelis
<input type="submit" name="submit" style="background: url(images/afbeelding.gif);" value="TEXT" />
Ik heb even een simpele demo in elkaar gezet om mijn probleem duidelijk te maken. Dat zijn de volgende scripts :
Demo.php
<html>
<head>
<title>demo.php</title>
<style type="text/css">
TABLE
{
background: ThreeDLightShadow;
color: CaptionText;
text-align: left;
}
TH { background: InactiveCaption; }
TD { color: WindowText; }
</style>
</head>
<body>
Code (php)
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
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
<?php
include_once("vid_card.php");
$first = "FIRST";
$prev = "PREV";
$next = "NEXT";
$last = "LAST";
if(empty($_POST) || $_POST["submit"] == $first)
{
$naam = "Jan Jansen";
$adres = "Stationsweg 123";
$postcode = "1234 AB";
$plaats = "Binnenkarpsel";
$telefoon = "0221234567";
}
elseif($_POST["submit"] == $prev)
{
$naam = "Karel de Groot";
$adres = "Kerkweg 3";
$postcode = "1234 BC";
$plaats = "Binnenkarpsel";
$telefoon = "0221234568";
}
elseif($_POST["submit"] == $next)
{
$naam = "Piet Vriend";
$adres = "Kerksteeg 5";
$postcode = "1234 CC";
$plaats = "Binnenkarpsel";
$telefoon = "0221234569";
}
elseif($_POST["submit"] == $last)
{
$naam = "Johannes Jansen";
$adres = "Achterweg 45";
$postcode = "1234 CD";
$plaats = "Binnenkarpsel";
$telefoon = "0221234560";
}
$line = 0;
$card = new Card("Adreskaart.");
$card->addLabel("Naam", $line);
$card->addText("naam", $naam, 30, $line++, true);
$card->addLabel("Adres", $line);
$card->addText("adres", $adres, 30, $line++, true);
$card->addLabel("Postcode", $line);
$card->addText("postcode", $postcode, 7, $line++, true);
$card->addLabel("Plaats", $line);
$card->addText("plaats", $plaats, 30, $line++, true);
$card->addLabel("Telefoon", $line);
$card->addText("telefoon", $telefoon, 10, $line++, true);
$card->addButton("submit", "submit", $first);
$card->addButton("submit", "submit", $prev);
$card->addButton("submit", "submit", $next);
$card->addButton("submit", "submit", $last);
$card->addUrl($_SERVER["PHP_SELF"]);
$card->showCard();
?>
include_once("vid_card.php");
$first = "FIRST";
$prev = "PREV";
$next = "NEXT";
$last = "LAST";
if(empty($_POST) || $_POST["submit"] == $first)
{
$naam = "Jan Jansen";
$adres = "Stationsweg 123";
$postcode = "1234 AB";
$plaats = "Binnenkarpsel";
$telefoon = "0221234567";
}
elseif($_POST["submit"] == $prev)
{
$naam = "Karel de Groot";
$adres = "Kerkweg 3";
$postcode = "1234 BC";
$plaats = "Binnenkarpsel";
$telefoon = "0221234568";
}
elseif($_POST["submit"] == $next)
{
$naam = "Piet Vriend";
$adres = "Kerksteeg 5";
$postcode = "1234 CC";
$plaats = "Binnenkarpsel";
$telefoon = "0221234569";
}
elseif($_POST["submit"] == $last)
{
$naam = "Johannes Jansen";
$adres = "Achterweg 45";
$postcode = "1234 CD";
$plaats = "Binnenkarpsel";
$telefoon = "0221234560";
}
$line = 0;
$card = new Card("Adreskaart.");
$card->addLabel("Naam", $line);
$card->addText("naam", $naam, 30, $line++, true);
$card->addLabel("Adres", $line);
$card->addText("adres", $adres, 30, $line++, true);
$card->addLabel("Postcode", $line);
$card->addText("postcode", $postcode, 7, $line++, true);
$card->addLabel("Plaats", $line);
$card->addText("plaats", $plaats, 30, $line++, true);
$card->addLabel("Telefoon", $line);
$card->addText("telefoon", $telefoon, 10, $line++, true);
$card->addButton("submit", "submit", $first);
$card->addButton("submit", "submit", $prev);
$card->addButton("submit", "submit", $next);
$card->addButton("submit", "submit", $last);
$card->addUrl($_SERVER["PHP_SELF"]);
$card->showCard();
?>
</body>
</html>
vid_card.php :
Code (php)
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
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
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
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
<?PHP
// Displaying data as a card.
// version 1.0 by Cornelis
// Free of all rights.
class field
{
var $type;
var $line;
var $name;
var $data;
var $align;
var $size;
var $rows;
var $disabled;
}
class button
{
var $type;
var $name;
var $value;
}
//-----------------------------------------------------------------------------
// Class card
//
// Displays and inputs data fields, makes automated lay-out.
//------------------------------------------------------------------------------
class Card
{
//---------- Class variables. ----------
var $title = "";
var $url = "";
var $fields = array();
var $buttons = array();
var $fill;
var $btns;
var $apply = "";
var $reset = "";
var $label = 1;
var $int = 2;
var $float = 3;
var $text = 4;
var $textarea = 5;
var $date = 6;
//---------- Constructor, create card object. ----------
function Card($title)
{
$this->fill = 0;
$this->btns = 0;
$this->title = $title;
}
//---------- Initialize field object for label. ----------
function addLabel($label, $line)
{
$field = new field();
$field->type = $this->label;
$field->name = $label;
$field->line = $line;
$field->rows = 0;
$this->fields[$this->fill++] = $field;
}
//---------- Initialize field object for text. ----------
function addText($name, $data, $size, $line, $enable)
{
$field = new field();
$field->type = $this->text;
$field->name = $name;
$field->data = $data;
$field->line = $line;
$field->align = "cardleft";
$field->size = $size;
$field->rows = 0;
if($enable) $field->disabled = "";
else $field->disabled = "disabled";
$this->fields[$this->fill++] = $field;
}
//---------- Initialize field object for int. ----------
function addInt($name, $data, $size, $line, $enable)
{
$field = new field();
$field->type = $this->int;
$field->name = $name;
$field->data = $data;
$field->line = $line;
$field->align = "cardleft";
$field->size = $size;
$field->rows = 0;
if($enable) $field->disabled = "";
else $field->disabled = "disabled";
$this->fields[$this->fill++] = $field;
}
//---------- Initialize field object for float. ----------
function addFloat($name, $data, $size, $line, $enable)
{
$field = new field();
$field->type = $this->float;
$field->name = $name;
$field->data = $data;
$field->line = $line;
$field->align = "cardleft";
$field->size = $size;
$field->rows = 0;
if($enable) $field->disabled = "";
else $field->disabled = "disabled";
$this->fields[$this->fill++] = $field;
}
//---------- Initialize field object for textarea. ----------
function addTextarea($name, $data, $size, $line, $rows, $enable)
{
$field = new field();
$field->type = $this->textarea;
$field->name = $name;
$field->data = $data;
$field->line = $line;
$field->align = "cardleft";
$field->size = $size;
$field->rows = $rows;
if($enable) $field->disabled = "";
else $field->disabled = "disabled";
$this->fields[$this->fill++] = $field;
}
//---------- Initialize field object for textarea. ----------
function addDate($name, $data, $size, $line, $enable)
{
$field = new field();
$field->type = $this->date;
$field->name = $name;
$field->data = $data;
$field->line = $line;
$field->align = "cardleft";
$field->size = $size;
$field->rows = 0;
if($enable) $field->disabled = "";
else $field->disabled = "disabled";
$this->fields[$this->fill++] = $field;
}
//---------- Initialize apply button. ----------
function addApply($button)
{
$this->apply = $button;
}
//---------- Initialize reset button. ----------
function addReset($button)
{
$this->reset = $button;
}
//---------- Initialize url. ----------
function addUrl($url)
{
$this->url = $url;
}
function addButton($type, $name, $value)
{
$button = new button();
$button->type = $type;
$button->name = $name;
$button->value = $value;
$this->buttons[$this->btns++] = $button;
}
//---------- Debug function. ----------
function debugCard()
{
for($i = 0; $i < $this->fill; $i++)
{
$field = $this->fields[$i];
echo("type : \"".$field->type."\", ");
echo("line : \"".$field->line."\", ");
echo("name : \"".$field->name."\", ");
echo("data : \"".$field->data."\", ");
echo("align : \"".$field->align."\", ");
echo("size : \"".$field->size."\", ");
echo("rows : \"".$field->rows."\", ");
echo("<br>\n");
}
}
//---------- Show card. ----------
function showCard()
{
//---------- Housekeeping and size calculations ----------
$maxlines = 17;
$line = 0;
$labelwidth = 0;
$maxcols = 0;
for($i = 0; $i < $maxlines; $i++) $column[$i] = 0;
for($i = 0; $i < $this->fill; $i++)
{
$field = $this->fields[$i];
if($field->type == $this->label && strlen($field->name) > $labelwidth)
$labelwidth = strlen($field->name);
$column[$field->line]++;
if($column[$field->line] > $maxcols) $maxcols = $column[$field->line];
}
$labelwidth = $labelwidth * 7;
$maxcols++;
//---------- Build up the screen ----------
echo("<form name=\"form1\" method=\"post\" action=\"".$this->url."\">\n");
echo("<table rules=\"groups\" border=\"1\" class=\"card\">\n");
echo("<tr>\n");
echo("<th class=\"thleft\" colspan=\"".$maxcols."\">");
echo($this->title);
echo("</th>\n");
echo("</tr>\n");
//---------- Display all labels and data fields. ----------
while($line < $maxlines)
{
$cols = FALSE;
echo("<tr>\n");
for($i = 0; $i < $this->fill; $i++)
{
$field = $this->fields[$i];
if($line == $field->line)
{
//---------- Field label. ----------
if($field->type == $this->label)
{
echo("<td class=\"cardleft\" width=\"".$labelwidth."\"pt>");
echo($field->name);
echo("</td>\n");
$cols = TRUE;
}
//---------- Inputable text field. ----------
elseif($field->type == $this->text)
{
echo("<td class=\"".$field->align."\">");
echo("<input ".$field->disabled." type=\"text\" ");
echo("name=\"".$field->name."\" ");
echo("id=\"".$field->name."\" ");
echo("size=\"".$field->size."\"pt ");
echo("value=\"".$field->data."\">");
echo("</td>\n");
$cols = TRUE;
}
//---------- Inputable int field. ----------
elseif($field->type == $this->int)
{
echo("<td class=\"".$field->align."\">");
echo("<input ".$field->disabled." type=\"text\" ");
echo("name=\"".$field->name."\" ");
echo("id=\"".$field->name."\" ");
echo("size=\"".$field->size."\"pt ");
echo("value=\"".$field->data."\">");
echo("</td>\n");
$cols = TRUE;
}
//---------- Inputable float field. ----------
elseif($field->type == $this->float)
{
echo("<td class=\"".$field->align."\">");
echo("<input ".$field->disabled." type=\"text\" ");
echo("name=\"".$field->name."\" ");
echo("id=\"".$field->name."\" ");
echo("size=\"".$field->size."\"pt ");
echo("value=\"".$field->data."\">");
echo("</td>\n");
$cols = TRUE;
}
//---------- Inputable text area. ----------
elseif($field->type == $this->textarea)
{
echo("<td class=\"".$field->align."\" ");
echo("colspan=\"".$maxcols."\" ");
echo("rowspan=\"".$field->rows."\">");
echo("<textarea ".$field->disabled."name=\"".$field->name."\" ");
echo("id=\"".$field->name."\" ");
echo("rows=\"".$field->rows."\" ");
echo("cols=\"".$field->size."\"pt ");
echo("value=\"".$field->data."\">");
echo("</textarea>");
echo("</td>\n");
$cols= TRUE;
}
//---------- Inputable text area. ----------
elseif($field->type == $this->date)
{
echo("<td class=\"".$field->align."\">");
echo("<input ".$field->disabled." type=\"text\" ");
echo("name=\"".$field->name."\" ");
echo("id=\"".$field->name."\" ");
echo("size=\"".$field->size."\"pt ");
echo("value=\"".date("d/m/Y", $field->data)."\">");
echo("</td>\n");
$cols = TRUE;
}
else
{
echo("<td></td>\n");
$cols = TRUE;
}
}
}
if($cols == FALSE)
echo("<td></td>\n");
echo("</tr>\n");
$line++;
}
echo("<tr><td colspan=\"3\">\n");
echo("<table rules=\"groups\" border=\"0\" class=\"card\">\n");
echo("<tr>\n");
for($i = 0; $i < 6; $i++)
{
echo("<td>\n");
if($i < $this->btns)
{
$button = $this->buttons[$i];
echo("<input ");
echo("type=\"".$button->type."\" ");
echo("name=\"".$button->name."\" ");
echo("value=\"".$button->value."\">\n");
}
echo("</td>\n");
}
echo("</tr>\n");
echo("</table>\n");
echo("</tr>\n");
echo("</table>\n");
echo("</form>\n");
}
}
?>
// Displaying data as a card.
// version 1.0 by Cornelis
// Free of all rights.
class field
{
var $type;
var $line;
var $name;
var $data;
var $align;
var $size;
var $rows;
var $disabled;
}
class button
{
var $type;
var $name;
var $value;
}
//-----------------------------------------------------------------------------
// Class card
//
// Displays and inputs data fields, makes automated lay-out.
//------------------------------------------------------------------------------
class Card
{
//---------- Class variables. ----------
var $title = "";
var $url = "";
var $fields = array();
var $buttons = array();
var $fill;
var $btns;
var $apply = "";
var $reset = "";
var $label = 1;
var $int = 2;
var $float = 3;
var $text = 4;
var $textarea = 5;
var $date = 6;
//---------- Constructor, create card object. ----------
function Card($title)
{
$this->fill = 0;
$this->btns = 0;
$this->title = $title;
}
//---------- Initialize field object for label. ----------
function addLabel($label, $line)
{
$field = new field();
$field->type = $this->label;
$field->name = $label;
$field->line = $line;
$field->rows = 0;
$this->fields[$this->fill++] = $field;
}
//---------- Initialize field object for text. ----------
function addText($name, $data, $size, $line, $enable)
{
$field = new field();
$field->type = $this->text;
$field->name = $name;
$field->data = $data;
$field->line = $line;
$field->align = "cardleft";
$field->size = $size;
$field->rows = 0;
if($enable) $field->disabled = "";
else $field->disabled = "disabled";
$this->fields[$this->fill++] = $field;
}
//---------- Initialize field object for int. ----------
function addInt($name, $data, $size, $line, $enable)
{
$field = new field();
$field->type = $this->int;
$field->name = $name;
$field->data = $data;
$field->line = $line;
$field->align = "cardleft";
$field->size = $size;
$field->rows = 0;
if($enable) $field->disabled = "";
else $field->disabled = "disabled";
$this->fields[$this->fill++] = $field;
}
//---------- Initialize field object for float. ----------
function addFloat($name, $data, $size, $line, $enable)
{
$field = new field();
$field->type = $this->float;
$field->name = $name;
$field->data = $data;
$field->line = $line;
$field->align = "cardleft";
$field->size = $size;
$field->rows = 0;
if($enable) $field->disabled = "";
else $field->disabled = "disabled";
$this->fields[$this->fill++] = $field;
}
//---------- Initialize field object for textarea. ----------
function addTextarea($name, $data, $size, $line, $rows, $enable)
{
$field = new field();
$field->type = $this->textarea;
$field->name = $name;
$field->data = $data;
$field->line = $line;
$field->align = "cardleft";
$field->size = $size;
$field->rows = $rows;
if($enable) $field->disabled = "";
else $field->disabled = "disabled";
$this->fields[$this->fill++] = $field;
}
//---------- Initialize field object for textarea. ----------
function addDate($name, $data, $size, $line, $enable)
{
$field = new field();
$field->type = $this->date;
$field->name = $name;
$field->data = $data;
$field->line = $line;
$field->align = "cardleft";
$field->size = $size;
$field->rows = 0;
if($enable) $field->disabled = "";
else $field->disabled = "disabled";
$this->fields[$this->fill++] = $field;
}
//---------- Initialize apply button. ----------
function addApply($button)
{
$this->apply = $button;
}
//---------- Initialize reset button. ----------
function addReset($button)
{
$this->reset = $button;
}
//---------- Initialize url. ----------
function addUrl($url)
{
$this->url = $url;
}
function addButton($type, $name, $value)
{
$button = new button();
$button->type = $type;
$button->name = $name;
$button->value = $value;
$this->buttons[$this->btns++] = $button;
}
//---------- Debug function. ----------
function debugCard()
{
for($i = 0; $i < $this->fill; $i++)
{
$field = $this->fields[$i];
echo("type : \"".$field->type."\", ");
echo("line : \"".$field->line."\", ");
echo("name : \"".$field->name."\", ");
echo("data : \"".$field->data."\", ");
echo("align : \"".$field->align."\", ");
echo("size : \"".$field->size."\", ");
echo("rows : \"".$field->rows."\", ");
echo("<br>\n");
}
}
//---------- Show card. ----------
function showCard()
{
//---------- Housekeeping and size calculations ----------
$maxlines = 17;
$line = 0;
$labelwidth = 0;
$maxcols = 0;
for($i = 0; $i < $maxlines; $i++) $column[$i] = 0;
for($i = 0; $i < $this->fill; $i++)
{
$field = $this->fields[$i];
if($field->type == $this->label && strlen($field->name) > $labelwidth)
$labelwidth = strlen($field->name);
$column[$field->line]++;
if($column[$field->line] > $maxcols) $maxcols = $column[$field->line];
}
$labelwidth = $labelwidth * 7;
$maxcols++;
//---------- Build up the screen ----------
echo("<form name=\"form1\" method=\"post\" action=\"".$this->url."\">\n");
echo("<table rules=\"groups\" border=\"1\" class=\"card\">\n");
echo("<tr>\n");
echo("<th class=\"thleft\" colspan=\"".$maxcols."\">");
echo($this->title);
echo("</th>\n");
echo("</tr>\n");
//---------- Display all labels and data fields. ----------
while($line < $maxlines)
{
$cols = FALSE;
echo("<tr>\n");
for($i = 0; $i < $this->fill; $i++)
{
$field = $this->fields[$i];
if($line == $field->line)
{
//---------- Field label. ----------
if($field->type == $this->label)
{
echo("<td class=\"cardleft\" width=\"".$labelwidth."\"pt>");
echo($field->name);
echo("</td>\n");
$cols = TRUE;
}
//---------- Inputable text field. ----------
elseif($field->type == $this->text)
{
echo("<td class=\"".$field->align."\">");
echo("<input ".$field->disabled." type=\"text\" ");
echo("name=\"".$field->name."\" ");
echo("id=\"".$field->name."\" ");
echo("size=\"".$field->size."\"pt ");
echo("value=\"".$field->data."\">");
echo("</td>\n");
$cols = TRUE;
}
//---------- Inputable int field. ----------
elseif($field->type == $this->int)
{
echo("<td class=\"".$field->align."\">");
echo("<input ".$field->disabled." type=\"text\" ");
echo("name=\"".$field->name."\" ");
echo("id=\"".$field->name."\" ");
echo("size=\"".$field->size."\"pt ");
echo("value=\"".$field->data."\">");
echo("</td>\n");
$cols = TRUE;
}
//---------- Inputable float field. ----------
elseif($field->type == $this->float)
{
echo("<td class=\"".$field->align."\">");
echo("<input ".$field->disabled." type=\"text\" ");
echo("name=\"".$field->name."\" ");
echo("id=\"".$field->name."\" ");
echo("size=\"".$field->size."\"pt ");
echo("value=\"".$field->data."\">");
echo("</td>\n");
$cols = TRUE;
}
//---------- Inputable text area. ----------
elseif($field->type == $this->textarea)
{
echo("<td class=\"".$field->align."\" ");
echo("colspan=\"".$maxcols."\" ");
echo("rowspan=\"".$field->rows."\">");
echo("<textarea ".$field->disabled."name=\"".$field->name."\" ");
echo("id=\"".$field->name."\" ");
echo("rows=\"".$field->rows."\" ");
echo("cols=\"".$field->size."\"pt ");
echo("value=\"".$field->data."\">");
echo("</textarea>");
echo("</td>\n");
$cols= TRUE;
}
//---------- Inputable text area. ----------
elseif($field->type == $this->date)
{
echo("<td class=\"".$field->align."\">");
echo("<input ".$field->disabled." type=\"text\" ");
echo("name=\"".$field->name."\" ");
echo("id=\"".$field->name."\" ");
echo("size=\"".$field->size."\"pt ");
echo("value=\"".date("d/m/Y", $field->data)."\">");
echo("</td>\n");
$cols = TRUE;
}
else
{
echo("<td></td>\n");
$cols = TRUE;
}
}
}
if($cols == FALSE)
echo("<td></td>\n");
echo("</tr>\n");
$line++;
}
echo("<tr><td colspan=\"3\">\n");
echo("<table rules=\"groups\" border=\"0\" class=\"card\">\n");
echo("<tr>\n");
for($i = 0; $i < 6; $i++)
{
echo("<td>\n");
if($i < $this->btns)
{
$button = $this->buttons[$i];
echo("<input ");
echo("type=\"".$button->type."\" ");
echo("name=\"".$button->name."\" ");
echo("value=\"".$button->value."\">\n");
}
echo("</td>\n");
}
echo("</tr>\n");
echo("</table>\n");
echo("</tr>\n");
echo("</table>\n");
echo("</form>\n");
}
}
?>
Hoe oud is dit script alwel niet...
m.vr.gr
Cornelis
Ik heb jouw advies geprobeerd
Dit : <input type="image" name="submit" src="images/afbeelding.gif" />
ziet er goed uiit, maar levert na indrukken coordinaten op. En daar ben ik niet in geinteresseerd.
Dit : <input type="submit" name="submit" style="background: url(images/afbeelding.gif);" value="TEXT" />
Zier er niet goed uit, het plaatje komt door de tekst "TEKST", het werkt wel goed, na indrukken $_POST["submit"] == "TEXT"
Dus de oplossing is er nog niet. Wie heeft nog een goed idee.
Cornelis
Code (php)
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
CSS:
input.submit{
background: #50708e url(images/button_bg.gif) repeat-x; /* Ik heb een afmeting van 19px 19px afbeelding */
color: #F2F3DE;
border: solid 1px #a6bbd9; /*Optioneel */
}
HTML:
<input class="submit" type="submit" name="submit" value="Verzenden" />
input.submit{
background: #50708e url(images/button_bg.gif) repeat-x; /* Ik heb een afmeting van 19px 19px afbeelding */
color: #F2F3DE;
border: solid 1px #a6bbd9; /*Optioneel */
}
HTML:
<input class="submit" type="submit" name="submit" value="Verzenden" />
Ik hoop dat je hier wat aan hebt :)
Heel mooi, en dit werkt ook nog. O.k. de kleuren zijn nog niet optimaal, maar dat is een kwestie van even verder zoeken. Ik gebruik de kleuren van de browser (ik ontwikkel onder windows/abyss/php) en ik wil graag dat de kleuren overgenomen worden van windows. Als de gebruiker zijn kleuren schema van windows wijzigt, wijzigt mijn applicatie mee. En dat werk al een hele tijd.
Cornelis
Toch ben ik er nog niet helemaal. Een css class werkt wel voor een knop. Maar als ik op wil schalen naar 4 of 6 knoppen, red ik het niet met een css class. En 6 css classes is wel een oplossing, maar vind ik niet fraai. Dan maar een inline css, maar dar lukt toch niet. Veel gezocht met google, van alles gelezen, bijvoorbeeld: http://www.webhacks.nl/linuxmag/06-2005/, maar nog geen oplossing.
Cornelis
Maar ik gebruik voor dit altijd css, werkt mooi in elk browser en OS. (mits je de goede css gebruikt natuurlijk)
<img src="url" onClick="document.formNaam.submit()" />
Groet,
Barry
Ik bedoelde dat ik meerdere knoppen met verschillende images wil gebruiken. Dat kan niet met 1 css class, en meerdere classes vind ik geen elegante oplossing, werkt wel overigens. Vandaar dat ik zoek naar een inline class. Zoiets als dit :
echo("<input ");
echo("style=\"background: url(".$button->img."); no-repeat\" ");
echo("type=\"".$button->type."\" ");
echo("name=\"".$button->name."\" ");
echo("value=\"".$button->value."\">\n");
Maar dit werkt niet omdat de tekst door het plaatje heen komt. De afhandeling van de knop is als volgt :
if($_POST["submit"] == $first) $record = 1;
if($_POST["submit"] == $prev && $record > 1) $record--;
if($_POST["submit"] == $next && $record < $lastrecord) $record++;
if($_POST["submit"] == $last) $record = $lastrecord;
Cornelis
Gewijzigd op 01/01/1970 01:00:00 door cornelis o