probleem invoeren agendascriptje
Ik heb een agendascriptje een beetje aangepast. Ik blijf echter het probleem houden dat nadat ik een nieuw agendapunt heb ingevoerd ik niet gelijk weer een agendapunt kan invoeren.
Ik kom er net echt uit. Is er iemand met een idee?
groet, Kabbi
code:
Code (php)
1
2
3
4
5
6
2
3
4
5
6
<?php
if (isset($_GET['eventid'])) {
$eventid = (get_magic_quotes_gpc()) ? $_GET['eventid'] : addslashes($_GET['eventid']);
} else { $eventid = $datumV;
}
?>
if (isset($_GET['eventid'])) {
$eventid = (get_magic_quotes_gpc()) ? $_GET['eventid'] : addslashes($_GET['eventid']);
} else { $eventid = $datumV;
}
?>
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
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
<?php
echo "<html><body bgcolor=#FFFFFF>";
echo "<form method=\"POST\" action=\"update.php\">";
mysql_select_db();
if ($_POST['del']) {
$delete = $_POST['delete'];
$array = explode(",",$delete);
$sql = "DELETE FROM ... WHERE ag_id='$array[0]' AND received='$array[1]'";
$result = mysql_query($sql, $db) or die ("Invalid query");
}
if ($_POST['submit']) {
$event_id = $_POST['eventid'] . " " . $_POST['hour'] . ":00:00";
$durhour = $_POST['hour'] + $_POST['event_finish'];
$event_finish = $_POST['eventid'] . " " . $durhour . ":00:00";
$userid= $_POST['userid'];
$event= $_POST['event'];
$event_type= $_POST['event_type'];
$sql2 = "INSERT INTO ...
(received,event,userid,event_type,event_finish, received2, event_finish2) VALUES('$eventid','$event',
'$userid', '$event_type', '$event_finish', '$event_id', '$event_finish')";
$result2 = mysql_query($sql2,$db) or die ("Invalid query insert");
echo "<b>Toegevoegd</b><br><br>";
}
$sql3 = "SELECT * from .... where received = '$eventid' ORDER BY
received";
$result3 = mysql_query($sql3,$db) or die ("Invalid query");
if (!mysql_num_rows($result3)) {
echo "Sorry er zijn geen agendapunten voor die datum..";
} else {
echo "Voor $eventid zijn de volgende agendapunten gevonden:";}
?>
echo "<html><body bgcolor=#FFFFFF>";
echo "<form method=\"POST\" action=\"update.php\">";
mysql_select_db();
if ($_POST['del']) {
$delete = $_POST['delete'];
$array = explode(",",$delete);
$sql = "DELETE FROM ... WHERE ag_id='$array[0]' AND received='$array[1]'";
$result = mysql_query($sql, $db) or die ("Invalid query");
}
if ($_POST['submit']) {
$event_id = $_POST['eventid'] . " " . $_POST['hour'] . ":00:00";
$durhour = $_POST['hour'] + $_POST['event_finish'];
$event_finish = $_POST['eventid'] . " " . $durhour . ":00:00";
$userid= $_POST['userid'];
$event= $_POST['event'];
$event_type= $_POST['event_type'];
$sql2 = "INSERT INTO ...
(received,event,userid,event_type,event_finish, received2, event_finish2) VALUES('$eventid','$event',
'$userid', '$event_type', '$event_finish', '$event_id', '$event_finish')";
$result2 = mysql_query($sql2,$db) or die ("Invalid query insert");
echo "<b>Toegevoegd</b><br><br>";
}
$sql3 = "SELECT * from .... where received = '$eventid' ORDER BY
received";
$result3 = mysql_query($sql3,$db) or die ("Invalid query");
if (!mysql_num_rows($result3)) {
echo "Sorry er zijn geen agendapunten voor die datum..";
} else {
echo "Voor $eventid zijn de volgende agendapunten gevonden:";}
?>
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?php
while ($row = mysql_fetch_array($result3)){
echo "<tr><td bgcolor=\"#FFFFFF\"><span class=\"style19\">$row[received2]</span></td><td bgcolor=\"#FFFFFF\">";
echo "<span class=\"style19\">$row[event]</span></td><td bgcolor=\"#FFFFFF\">";
echo "<span class=\"style19\">$row[event_type]</span></td><td bgcolor=\"#FFFFFF\">";
echo "<span class=\"style19\">$row[event_finish2]</span></td><td bgcolor=\"#FFFFFF\">";
echo "<span class=\"style19\">$row[userid]</span></td><td bgcolor=\"#FFFFFF\">";
echo "<input
type=\"radio\" value=\"$row[ag_id],$row[received]\" name=\"delete\"></td></tr>";
}
?>
while ($row = mysql_fetch_array($result3)){
echo "<tr><td bgcolor=\"#FFFFFF\"><span class=\"style19\">$row[received2]</span></td><td bgcolor=\"#FFFFFF\">";
echo "<span class=\"style19\">$row[event]</span></td><td bgcolor=\"#FFFFFF\">";
echo "<span class=\"style19\">$row[event_type]</span></td><td bgcolor=\"#FFFFFF\">";
echo "<span class=\"style19\">$row[event_finish2]</span></td><td bgcolor=\"#FFFFFF\">";
echo "<span class=\"style19\">$row[userid]</span></td><td bgcolor=\"#FFFFFF\">";
echo "<input
type=\"radio\" value=\"$row[ag_id],$row[received]\" name=\"delete\"></td></tr>";
}
?>
<input type="hidden" name="eventid" value="">
<input name="del" type="submit" class="knp" value="Verwijder Agendapunt">
</form>
</p>
<form method="POST" action="update.php"><br><br>
<span class="style19">Voeg een agendapunt toe voor
<input type="hidden" name="eventid" value="">
<br>
Uur:
<select name="hour">
<option value="01">01:00
<option value="02">02:00
<option value="03">03:00
<option value="04">04:00
<option value="05">05:00
<option value="06">06:00
<option value="07">07:00
<option value="08">08:00
<option value="09">09:00
<option value="10">10:00
<option value="11">11:00
<option value="12">12:00
<option value="13">13:00
<option value="14">14:00
<option value="15">15:00
<option value="16">16:00
<option value="17">17:00
<option value="18">18:00
<option value="19">19:00
<option value="20">20:00
<option value="21">21:00
<option value="22">33:00
<option value="23">23:00
</select>
<br>
Agendapunt Informatie:<br>
<textarea name="event" cols="20" rows="5"></textarea>
<br>
Gebruiker:<br>
<input type="text" name="userid">
<br>
omschrijving agendapunt:<br>
<input type="text" name="event_type">
<br>
Tijdsduur (in uren):<br>
<input type="text" name="event_finish">
</span><br>
<input name="submit" type="submit" class="knp" value="Agendapunt Toevoegen">
</form>
Dit script werk perfect. Ik had het id veld in de database tabel niet ingesteld op aut_increment :)
Grt. Kabbi