[go: up one dir, main page]

Menu

[r99]: / tags / 1.3 / modifyentry.php  Maximize  Restore  History

Download this file

161 lines (157 with data), 4.9 kB

  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
<?php
# $Id: modifyentry.php 86 2010-10-05 12:19:27Z rediculum $
#
# Includes
####################################################################
include("includes/session.inc.php");
include("includes/layout.inc.php");
include("includes/functions.inc.php");
include("includes/db.inc.php");
include("includes/variables.inc.php");
# Main
#####################################################################?>
<html>
<head>
<?php echo "$headtitle $head";?>
</head>
<body>
<div id=menu>
<?php include("includes/menu.inc.php");?>
</div>
<div id=mainframe>
<table bgcolor="#FFFFFF">
<tr><td valign=top align=left width=500>
<?
if ($_POST[id] == "") {
echo "<font color=red>$ERROR: $number $missing";
exit(1);
}
if (isset($_POST[delete])) {
echo "$entrynumber <i>$_POST[id] </i>$deleted";
mysql_query("DELETE FROM $_POST[table] WHERE id='$_POST[id]'") or die (mysql_error());
exit(0);
}
if (isset($_POST[modifyentry])) {
$textbutton = "$entry $edit";
$targetfile = "modify.php";
}
if (isset($_POST[copy])) {
$textbutton = "$entry $copy";
$targetfile = "copy.php";
}
echo "$entrynumber <i>$_POST[id]</i>:";?>
<table border=0 cellpadding=4 cellspacing=1>
<tr align=center bgcolor="#EEEEEE">
<?
print("<td><b>$day</td>
<td><b>$month</td>
<td><b>$year</td>
<td><b>$entrytext</td>
<td><b>$amount</td>
<td><b>$source</td>
<td><b>$maincategory</td>
<td><b>$subcategory</td>
<td><b>$shared_s</td>
");
?>
</tr><tr>
<td valign=top>
<?
$result = mysql_query("SELECT * FROM $_POST[table] WHERE id='$_POST[id]'");
while ($output=mysql_fetch_array($result)) {
echo "<form method=post action=$targetfile>";
if ($_POST[table] == verbuchungen) {
echo "<select size=1 name=\"tag\">";
foreach (range(1,31) as $day) {
if ($day == $output[1]) {
echo "<option selected value=$output[1]>$day</option>";
} else {
echo "<option value=$day>$day</option>";
}
}
echo "</select>";
} else {
echo "<input type=text name=\"tag\" size=3 maxlenght=2 value=$output[1]>";
}?>
</td><td valign=top>
<?php if ($_POST[table] == verbuchungen) {
echo "<select size=1 name=\"monat\" required=yes>";
foreach (range(1,12) as $month) {
if ($month == $output[2]) {
echo "<option selected value=$output[2]>$month</option>";
} else {
echo "<option value=$month>$month</option>";
}
}
echo "</select>";
} else {
echo "<input type=text name=\"monat\" size=3 maxlenght=2 value=$output[2]>";
}?>
</td><td valign=top>
<?php if ($_POST[table] == verbuchungen) {
echo "<select size=1 name=\"jahr\">";
echo "<option value=" . ($output[3]-1) . ">" . ($output[3]-1) . "</option>";
echo "<option selected value=$output[3]>$output[3]</option>";
echo "<option value=" . ($output[3]+1) . ">" . ($output[3]+1) . "</option>";
echo "</select>";
} else {
echo "<input type=text name=\"jahr\"size=3 maxlenght=2 value=$output[3]>";
}
echo "</td><td valign=top>";
echo "<input type=text name=\"text\" value=\"$output[10]\">";
echo "</td><td valign=top>";
echo "$currency <input type=text name=\"betrag\" size=\"6\" maxlenght=\"6\" value=\"$output[4]\">";
echo "</td><td valign=top>";
echo "<select size=1 name=\"q_id\">";
$result2= mysql_query("SELECT q_id,q_name FROM quelle") or die (mysql_error());
while ($resultarr = mysql_fetch_array($result2)) {
if ($resultarr[0] == $output[5]) {
echo ("<option selected value=$output[5]>$resultarr[1]</option>");
} else {
echo ("<option value=$resultarr[0]>$resultarr[1]</option>");
}
}
echo "</select>";
echo "</td><td valign=top>";
echo "<select size=1 name=\"hk_id\">";
$result2= mysql_fetch_row(mysql_query("SELECT hk_id,hk_name FROM hauptkategorien WHERE hk_id='$output[6]'")) or die (mysql_error());
echo ("<option selected value=$output[6]>$result2[1]</option>");
echo "</select>";
echo "</td><td valign=top>";
echo "<select size=1 name=\"sk_id\">";
$result2 = mysql_query("SELECT sk_id,sk_name FROM subkategorien WHERE hk_id='$output[6]' ORDER BY sk_id") or die (mysql_error());
while ($resultarr = mysql_fetch_array($result2)) {
if ($resultarr[0] == $output[7]) {
echo ("<option selected value=$output[7]>$resultarr[1]</option>");
} else {
echo ("<option value=$resultarr[0]>$resultarr[1]</option>");
}
}
echo "</select>";
echo "</td><td valign=top>";
if ($output[9] == "1") {
echo "<input type=checkbox checked name=\"shared\" value=\"1\">";
} else {
echo "<input type=checkbox name=\"shared\" value=\"1\">";
}?>
</td></tr>
<tr><td>
</td>
<td>
</td>
<td>
</td>
<td align=center>
<input type=hidden name=id value=<?php echo $output[0];?>>
<input type=hidden name=table value=<?php echo $_POST[table];?>>
<input type=submit name=submit class=button_click value="<?php echo $textbutton;?>">
</td></tr>
</table>
<p>
</form>
<?}?>
</td></tr>
</table>
</div>
</body>
</html>