2 dingen invoeren; voert hij het dubbele in
Als ik 2 dingen wil invoeren, voert hij het dubbele in.
Ik snap niet hoe het komt. Dit is de code:
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
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
<?php
include"../lol";
$map = "/usr/local/psa/home/vhosts/lol/";
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
switch( strtolower( $_POST['formName'] ) )
{
case "aantal":
if( isset( $_POST['aantal'] ) && is_numeric( $_POST['aantal'] ) && $_POST['aantal'] > 0 && $_POST['aantal'] < 20 )
{
print"<form method=\"post\" enctype=\"multipart/form-data\"> "
. "<input type='hidden' name='formName' value='check' />
<table width=\"200\" border=\"0\">";
for( $i = 0; $i < $_POST['aantal']; $i++ )
{
print"<tr>
<td valign=\"top\">
<input type=\"file\" name=\"file[]\" />
</td>
<td>
<textarea name=\"inputs[]\" cols=\"50\" rows=\"5\"></textarea>
</td>
</tr>";
}
print"</table><input type='submit' value='Verstuur' />\n</form>";
}
else
{
print"Een error (:";
}
break;
case "check":
if( isset( $_POST['inputs'] ) && is_array($_POST['inputs'] ) && count( $_POST['inputs'] ) )
{
mysql_query("INSERT INTO `nieuwsbrieven` (id,datum) VALUES ('',NOW())");
foreach( $_POST['inputs'] as $value )
{
if( empty( $value ) )
{
// Een lege boxje, sla hem over :)
$ja = false;
}
else
{
$ja = true;
$blaat = $value;
}
if( $ja )
{
for( $i = 0, $j = count($_FILES['file']['name']); $i < $j; $i++ )
{
move_uploaded_file($_FILES['file']['tmp_name'][$i], $map.$_FILES['file']['name'][$i]);
$filedan[] = $_FILES['file']['name'][$i];
}
}
}
foreach ( $filedan as $file )
{
$sqltje = mysql_query("SELECT * FROM `nieuwsbrieven` ORDER BY `id` DESC LIMIT 1");
$lastid = mysql_fetch_assoc($sqltje);
$idtje = $lastid['id'];
mysql_query("INSERT INTO `nws_data` (nieuwsbriefid, plaatje, tekst) VALUES ('" . $idtje . "', 'http://www.the-syllie.nl/2004/nieuwsbrief/plaatjes/" . $file . "', '" . $value . "')");
}
print"De nieuwsbrief is met suc6 aangemaakt! Klik <a href='newsbekijk.php'>hier</a> om de nieuwsbrief te bekijken of te bewerken!";
}
break;
}
}
else
{
print "<form action=\"" . $_SERVER[ "REQUEST_URI"] . "\" method=\"post\">"
. "<input type=\"hidden\" name=\"formName\" value=\"aantal\" />";
?>
<table width="50%" border="0">
<tr>
<td width="25%">Aantal boxen</td>
<td width="25%"><input type="text" name="aantal"></td>
</tr>
<tr>
<td><input type="submit" name="Submit" value="Submit"></td>
</tr>
</table>
</form>
<?
}
?>
include"../lol";
$map = "/usr/local/psa/home/vhosts/lol/";
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
switch( strtolower( $_POST['formName'] ) )
{
case "aantal":
if( isset( $_POST['aantal'] ) && is_numeric( $_POST['aantal'] ) && $_POST['aantal'] > 0 && $_POST['aantal'] < 20 )
{
print"<form method=\"post\" enctype=\"multipart/form-data\"> "
. "<input type='hidden' name='formName' value='check' />
<table width=\"200\" border=\"0\">";
for( $i = 0; $i < $_POST['aantal']; $i++ )
{
print"<tr>
<td valign=\"top\">
<input type=\"file\" name=\"file[]\" />
</td>
<td>
<textarea name=\"inputs[]\" cols=\"50\" rows=\"5\"></textarea>
</td>
</tr>";
}
print"</table><input type='submit' value='Verstuur' />\n</form>";
}
else
{
print"Een error (:";
}
break;
case "check":
if( isset( $_POST['inputs'] ) && is_array($_POST['inputs'] ) && count( $_POST['inputs'] ) )
{
mysql_query("INSERT INTO `nieuwsbrieven` (id,datum) VALUES ('',NOW())");
foreach( $_POST['inputs'] as $value )
{
if( empty( $value ) )
{
// Een lege boxje, sla hem over :)
$ja = false;
}
else
{
$ja = true;
$blaat = $value;
}
if( $ja )
{
for( $i = 0, $j = count($_FILES['file']['name']); $i < $j; $i++ )
{
move_uploaded_file($_FILES['file']['tmp_name'][$i], $map.$_FILES['file']['name'][$i]);
$filedan[] = $_FILES['file']['name'][$i];
}
}
}
foreach ( $filedan as $file )
{
$sqltje = mysql_query("SELECT * FROM `nieuwsbrieven` ORDER BY `id` DESC LIMIT 1");
$lastid = mysql_fetch_assoc($sqltje);
$idtje = $lastid['id'];
mysql_query("INSERT INTO `nws_data` (nieuwsbriefid, plaatje, tekst) VALUES ('" . $idtje . "', 'http://www.the-syllie.nl/2004/nieuwsbrief/plaatjes/" . $file . "', '" . $value . "')");
}
print"De nieuwsbrief is met suc6 aangemaakt! Klik <a href='newsbekijk.php'>hier</a> om de nieuwsbrief te bekijken of te bewerken!";
}
break;
}
}
else
{
print "<form action=\"" . $_SERVER[ "REQUEST_URI"] . "\" method=\"post\">"
. "<input type=\"hidden\" name=\"formName\" value=\"aantal\" />";
?>
<table width="50%" border="0">
<tr>
<td width="25%">Aantal boxen</td>
<td width="25%"><input type="text" name="aantal"></td>
</tr>
<tr>
<td><input type="submit" name="Submit" value="Submit"></td>
</tr>
</table>
</form>
<?
}
?>
Geen error enzo.. http://www.the-syllie.nl/nieuwsbrief/newsbekijk.php staat hij, dus hij moest eigenlijk de 2 bovenste alleen maar laten zien.
Iemand die me kan helpen :'(?
Gewijzigd op 01/01/1970 01:00:00 door Stan
Er zijn nog geen reacties op dit bericht.