header issue (ik weet het, staat al in de forum maar geraak er niet uit)
en heb deze ok al doornomen
issue zit bij Case 2 tussen de //********--------------------------****************/
hier krijg ik de header topic.
wat ik vreemd vind is dat bij case 4 (helemaal onderaan code)
ook een header functie zit en deze zonder problemen doorloopt
ik weet dat de code hoogstwaarschijnlijk niet logisch is en/of kan veranderen / verbeteren, maar dit even buiten beschouwing nemen.
ik snap niet vanwaar de header error komt
volgens de error code zit fout bij het openen van de php 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
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
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
//**************************--------------------------***********************************************/
<?php
[/code]
groter deel van de code
[code]
/****************************************************************************************/
// check voor toevoegen
/****************************************************************************************/
case 2:
/********************************************************************************************************/
//de geposte variabelen uit case 1
$naam_op= strtoupper(trim(mysqli_real_escape_string($link,$_POST['naam_op'])));
$datumOP= date("Y-m-d H:i:s");
$OP_HIDDEN_DELETE= "0";
$operator_dep="qc";
$bestaat_die_al= mysqli_query($link,"SELECT * FROM operator WHERE N_operator='$naam_op' ");
while($row_bestaat_die_al = mysqli_fetch_array($bestaat_die_al))
{
$persoon_bestaat_al = $row_bestaat_die_al['N_operator'];
};
/********************************************************************************************************/
//controleren of er alle velden ok zijn
?>
<h2> Persoon Toevoegen</h2>
<form action="QC_ingave.php?keuze=1&putaway=1" method="post" enctype="multipart/form-data" >
<table class="table table-striped">
<tr>
<td width="232" class="titelformulier" > Datum: </td>
<td width="554" colspan="2" class="outputformulier" ><?php echo date("d/M/Y"); ?>
</td>
</tr>
<tr>
<td class="titelformulier" >Naam:</td>
<td class="outputformulier" >
<input name="naam_op" type="text" size="60" value="<?php echo $naam_op; ?>"/></td>
<td class="outputformulier" ><?php if(empty ($naam_op)||!empty ($persoon_bestaat_al)) { echo '<img src="..\pictures\wrong.png" width="22" height="22"/>';}?></td>
</tr>
<tr>
<td class="titelformulier" ></td>
<td class="outputformulier" ></td>
<td class="outputformulier" ></td>
</tr>
<tr>
<td height="57" class="tekstfrom"></td>
<td colspan="2" class="tekstfrom"><h3>
<input type="submit" class="enterknop" value="Toevoegen"/>
</h3></td>
</tr>
</table>
</form>
//**************************--------------------------***********************************************/
<?php
if (!empty($naam_op) && empty($persoon_bestaat_al))
{
//het effectief wegschrijven naar tabel operator
$sqlOP= mysqli_query($link,"INSERT INTO operator (N_operator,OP_datum, OP_HIDDEN_DELETE, operator_dep)
VALUES ('$naam_op', '$datumOP', '$OP_HIDDEN_DELETE','$operator_dep')");
header('Location: http://'.$dns.'admin_qc/QC_ingave.php?keuze=0');
}
//**************************--------------------------***********************************************/
break;
/****************************************************************************************/
// update tonen lijst UPDATE
/****************************************************************************************/
case 3:
$result = mysqli_query($link,"SELECT *,DATE_FORMAT(OP_DATUM,'%d.%b.%Y om %Hu%i')AS newOP_DATUM,DATE_FORMAT(OP_DATUM_ADJUST,'%d.%b.%Y om %Hu%i')AS newOP_DATUM_ADJUST FROM operator WHERE OP_HIDDEN_DELETE='0' AND operator_dep='$user' ORDER BY N_OPERATOR ASC");
?>
<h2 class="titel"> Selecteer de lijn die moet worden aangepast.</h2>
<form action="QC_ingave.php?keuze=2&putaway=2" method="post" name="update" >
<table class="table table-striped">
<tr class="titelformulier">
<th width="165" align="center"></th>
<th width="263" align="center"><strong>Naam</strong></th>
<th width="246" align="center"><strong>Toegevoegd op</strong></th>
<th width="206" align="center"><strong>wijziging op</strong></th>
</tr>
<?php
while($rowupdate = mysqli_fetch_array($result))
{
//******************************************************************************************************
//BELANGRIJK de eerste rij 0 is voor de tabel een blanco te laten zien. deze nooit verwijderen.
// <?php if($rowupdate['NR_OPL']==1){echo""; }else{ echo $rowupdate['NR_A_STEMPEL'] ;}
// => dit script zorgt ervoor dat die lijn NOOIT zichtbaar is.
//******************************************************************************************************
?>
<tr>
<td class="outputformulierupdate" align="center">
<?php if($rowupdate['NR_OP']==1){echo""; }else{ $selectradio=$rowupdate['NR_OP'] ; echo"<input name='NR_OP' type='radio' value='$selectradio' />";} if(!empty($selectradio)){
echo "";}else{}?>
</td>
<td class="outputformulierupdate"align="center">
<?php if($rowupdate['NR_OP']==1){echo""; }else{ echo $rowupdate['N_operator'] ;}?>
</td>
<td class="outputformulierupdate"align="center">
<?php if($rowupdate['NR_OP']==1){echo""; }else{ echo $rowupdate['newOP_DATUM'] ;}?>
</td>
<td class="outputformulierupdate"align="center">
<?php if($rowupdate['NR_OP']==1){echo"";}else{ if(!empty($rowupdate['newOP_DATUM_ADJUST'])) {echo $rowupdate['newOP_DATUM_ADJUST']; $updatedatum=$rowupdate['newOP_DATUM_ADJUST'];}else{ echo"";}}?>
</td>
<?php }
?>
</tr>
<tr>
<td height="74" align="center" class="outputformulierupdate"><input type="submit" class="enterknop" value="Aanpassen" /></td>
</tr>
</form>
</table>
<?php
break;
/****************************************************************************************/
// update effectief uitvoeren
/****************************************************************************************/
case 4:
$OP_NR = $_POST['NR_OP'];
$naam_op = strtoupper($_POST['naam_op']);
$naam_op_old = strtoupper($_POST['naam_op_old']);
$datumOP_update= date("Y-m-d H:i:s");
$secrun = $_POST['secrun'];
if (!empty($naam_op) && (is_numeric($naam_op))||empty($secrun)) {
?>
<h1 class="titel"> Pas de gegevens aan</h1>
<table class="table table-striped">
<form action="QC_ingave.php?keuze=2&putaway=2" method="post" />
<tr class="titelformulier">
<th width="528" align="center"><strong>Naam</strong></th>
</tr>
<?php
$result = mysqli_query($link,"SELECT * FROM operator WHERE NR_OP='$OP_NR'");
while($rowupdate = mysqli_fetch_array($result))
{
$naam_ex= $rowupdate['N_operator'];
$naam_op_old= $rowupdate['N_operator'];
?>
<tr>
<td class="outputformulierupdate" align="center"></td>
<tr>
<td class="outputformulierupdate" align="center"><?php echo $naam_op_old;?></td>
<tr>
<td class="outputformulierupdate" align="center"> </td>
<tr>
<td class="outputformulierupdate" align="center">
<span class="outputformulierupdate">
<input name="naam_op" type="text" size="40" value="<?php echo $naam_ex ;?>"/>
</span>
<tr>
<input name="NR_OP" type="hidden"value="<?php echo $OP_NR; ?>" />
<input name="naam_op_old" type="hidden"value="<?php echo $naam_op_old; ?>" />
<input name="secrun" type="hidden"value="1" />
<td height="66" align="center">
<input type="submit" class="enterknop" value="Update Verzenden" />
</table>
</form>
<?php }}else{
//het effectief updaten naar tabel operator
$sqlOP= mysqli_query($link,"UPDATE operator SET
N_operator='$naam_op',
N_operator_old='$naam_op_old',
OP_DATUM_ADJUST='$datumOP_update'
WHERE NR_OP='$OP_NR'");
header('Location: http://'.$dns.'admin_qc/QC_ingave.php?keuze=0');
}
break;
[/code]
<?php
[/code]
groter deel van de code
[code]
/****************************************************************************************/
// check voor toevoegen
/****************************************************************************************/
case 2:
/********************************************************************************************************/
//de geposte variabelen uit case 1
$naam_op= strtoupper(trim(mysqli_real_escape_string($link,$_POST['naam_op'])));
$datumOP= date("Y-m-d H:i:s");
$OP_HIDDEN_DELETE= "0";
$operator_dep="qc";
$bestaat_die_al= mysqli_query($link,"SELECT * FROM operator WHERE N_operator='$naam_op' ");
while($row_bestaat_die_al = mysqli_fetch_array($bestaat_die_al))
{
$persoon_bestaat_al = $row_bestaat_die_al['N_operator'];
};
/********************************************************************************************************/
//controleren of er alle velden ok zijn
?>
<h2> Persoon Toevoegen</h2>
<form action="QC_ingave.php?keuze=1&putaway=1" method="post" enctype="multipart/form-data" >
<table class="table table-striped">
<tr>
<td width="232" class="titelformulier" > Datum: </td>
<td width="554" colspan="2" class="outputformulier" ><?php echo date("d/M/Y"); ?>
</td>
</tr>
<tr>
<td class="titelformulier" >Naam:</td>
<td class="outputformulier" >
<input name="naam_op" type="text" size="60" value="<?php echo $naam_op; ?>"/></td>
<td class="outputformulier" ><?php if(empty ($naam_op)||!empty ($persoon_bestaat_al)) { echo '<img src="..\pictures\wrong.png" width="22" height="22"/>';}?></td>
</tr>
<tr>
<td class="titelformulier" ></td>
<td class="outputformulier" ></td>
<td class="outputformulier" ></td>
</tr>
<tr>
<td height="57" class="tekstfrom"></td>
<td colspan="2" class="tekstfrom"><h3>
<input type="submit" class="enterknop" value="Toevoegen"/>
</h3></td>
</tr>
</table>
</form>
//**************************--------------------------***********************************************/
<?php
if (!empty($naam_op) && empty($persoon_bestaat_al))
{
//het effectief wegschrijven naar tabel operator
$sqlOP= mysqli_query($link,"INSERT INTO operator (N_operator,OP_datum, OP_HIDDEN_DELETE, operator_dep)
VALUES ('$naam_op', '$datumOP', '$OP_HIDDEN_DELETE','$operator_dep')");
header('Location: http://'.$dns.'admin_qc/QC_ingave.php?keuze=0');
}
//**************************--------------------------***********************************************/
break;
/****************************************************************************************/
// update tonen lijst UPDATE
/****************************************************************************************/
case 3:
$result = mysqli_query($link,"SELECT *,DATE_FORMAT(OP_DATUM,'%d.%b.%Y om %Hu%i')AS newOP_DATUM,DATE_FORMAT(OP_DATUM_ADJUST,'%d.%b.%Y om %Hu%i')AS newOP_DATUM_ADJUST FROM operator WHERE OP_HIDDEN_DELETE='0' AND operator_dep='$user' ORDER BY N_OPERATOR ASC");
?>
<h2 class="titel"> Selecteer de lijn die moet worden aangepast.</h2>
<form action="QC_ingave.php?keuze=2&putaway=2" method="post" name="update" >
<table class="table table-striped">
<tr class="titelformulier">
<th width="165" align="center"></th>
<th width="263" align="center"><strong>Naam</strong></th>
<th width="246" align="center"><strong>Toegevoegd op</strong></th>
<th width="206" align="center"><strong>wijziging op</strong></th>
</tr>
<?php
while($rowupdate = mysqli_fetch_array($result))
{
//******************************************************************************************************
//BELANGRIJK de eerste rij 0 is voor de tabel een blanco te laten zien. deze nooit verwijderen.
// <?php if($rowupdate['NR_OPL']==1){echo""; }else{ echo $rowupdate['NR_A_STEMPEL'] ;}
// => dit script zorgt ervoor dat die lijn NOOIT zichtbaar is.
//******************************************************************************************************
?>
<tr>
<td class="outputformulierupdate" align="center">
<?php if($rowupdate['NR_OP']==1){echo""; }else{ $selectradio=$rowupdate['NR_OP'] ; echo"<input name='NR_OP' type='radio' value='$selectradio' />";} if(!empty($selectradio)){
echo "";}else{}?>
</td>
<td class="outputformulierupdate"align="center">
<?php if($rowupdate['NR_OP']==1){echo""; }else{ echo $rowupdate['N_operator'] ;}?>
</td>
<td class="outputformulierupdate"align="center">
<?php if($rowupdate['NR_OP']==1){echo""; }else{ echo $rowupdate['newOP_DATUM'] ;}?>
</td>
<td class="outputformulierupdate"align="center">
<?php if($rowupdate['NR_OP']==1){echo"";}else{ if(!empty($rowupdate['newOP_DATUM_ADJUST'])) {echo $rowupdate['newOP_DATUM_ADJUST']; $updatedatum=$rowupdate['newOP_DATUM_ADJUST'];}else{ echo"";}}?>
</td>
<?php }
?>
</tr>
<tr>
<td height="74" align="center" class="outputformulierupdate"><input type="submit" class="enterknop" value="Aanpassen" /></td>
</tr>
</form>
</table>
<?php
break;
/****************************************************************************************/
// update effectief uitvoeren
/****************************************************************************************/
case 4:
$OP_NR = $_POST['NR_OP'];
$naam_op = strtoupper($_POST['naam_op']);
$naam_op_old = strtoupper($_POST['naam_op_old']);
$datumOP_update= date("Y-m-d H:i:s");
$secrun = $_POST['secrun'];
if (!empty($naam_op) && (is_numeric($naam_op))||empty($secrun)) {
?>
<h1 class="titel"> Pas de gegevens aan</h1>
<table class="table table-striped">
<form action="QC_ingave.php?keuze=2&putaway=2" method="post" />
<tr class="titelformulier">
<th width="528" align="center"><strong>Naam</strong></th>
</tr>
<?php
$result = mysqli_query($link,"SELECT * FROM operator WHERE NR_OP='$OP_NR'");
while($rowupdate = mysqli_fetch_array($result))
{
$naam_ex= $rowupdate['N_operator'];
$naam_op_old= $rowupdate['N_operator'];
?>
<tr>
<td class="outputformulierupdate" align="center"></td>
<tr>
<td class="outputformulierupdate" align="center"><?php echo $naam_op_old;?></td>
<tr>
<td class="outputformulierupdate" align="center"> </td>
<tr>
<td class="outputformulierupdate" align="center">
<span class="outputformulierupdate">
<input name="naam_op" type="text" size="40" value="<?php echo $naam_ex ;?>"/>
</span>
<tr>
<input name="NR_OP" type="hidden"value="<?php echo $OP_NR; ?>" />
<input name="naam_op_old" type="hidden"value="<?php echo $naam_op_old; ?>" />
<input name="secrun" type="hidden"value="1" />
<td height="66" align="center">
<input type="submit" class="enterknop" value="Update Verzenden" />
</table>
</form>
<?php }}else{
//het effectief updaten naar tabel operator
$sqlOP= mysqli_query($link,"UPDATE operator SET
N_operator='$naam_op',
N_operator_old='$naam_op_old',
OP_DATUM_ADJUST='$datumOP_update'
WHERE NR_OP='$OP_NR'");
header('Location: http://'.$dns.'admin_qc/QC_ingave.php?keuze=0');
}
break;
[/code]
De error zou ook de lijn moeten aangeven waar de output te vinden is.
Maar waarom werkt dit bij case 4 dan wel.
En het heeft gewerkt maar toen ik nog een extra check inbouwde
Vooraleer de insert te doen naar de tabel
Update
Het heeft met de if functie te maken die bij 4 is en bij 2 niet
Ik had de if boven de input moeten zetten
En daarna ne else voor de insert
Case closed
Gewijzigd op 13/10/2022 21:20:19 door chris Bosmans