Gegevens uit MySQL db halen
In dit form zit een dropdownlist waar een week gekozen kan worden.
Wat wil ik?
- Op het moment dat er door een gebruiker een week word geselecteerd die al een keer is ingevuld, moeten de oude gegevens worden opgehaald uit MySQL, deze moet de gebruiker dan kunnen aanpassen.
- Op het moment dat er de checkbox 'beschikbaarheid' word aangevinkt, moeten de waarde worden meegenomen naar alle opvolgende weken.
- Daarnaast is het zo dat de gebruikers tot een bepaald moment een week kunnen invoeren hoe zou ik na dit moment de week in het forum kunnen laten vervallen.
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
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
<?
/*
php login system
(c) Michael Zelensky miha.in 2012
*/
include_once ('inc/start.inc');
?><!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
<script src="/js/app.js" type="text/javascript"></script>
<link rel="stylesheet" href="/css/style.css" type="text/css" />
</head>
<body>
<h1> 1.0</h1>
<p><a href="index.php">Home</a> <a href="beschikbaarheid.php">Beschikbaarheid</a>
<?
if (!isset($_SESSION['user_id'])) {
$display = "display:none";
?>
<div id="login">
Login:
<br>
<form id="form_login">
<input type="text" name="login_email" class="login_inactive"/>
<input type="password" name="login_password" class="login_inactive"/>
<a href="#" id="form_login_submit" class="form_button">Submit</a> <img src="/img/ajax-loader.gif" style="display:none" id="login_loader">
<div id="login_error" style="display:none" class="login_error">Wrong email/password!</div>
<div id="not_confirmed_error" style="display:none" class="login_error">Registration not complete! <a href="/register/resend.php">Resend confirmation email</a></div>
<br>
<a href="/register/reminder.php">Forgot password?</a> <a href="/register/">Register</a>
</form>
</div>
<? } else {
$display = "";
}
?>
<div id="loggedin" style="<?=$display?>">
<p>Hallo , <a href="#" id="user_naam">
<?=$_SESSION['user_naam']?>
</a><a href="#" id="user_logout" class="logout_link">Logout</a>
</p>
<body>
<form id="form1" name="form1" method="post" action="verstuur.php">
<p> </p>
<table width="325" border="0">
<tr>
<td width="42">Naam</td>
<td width="273"><input name="naam" type="text" id="naam" value="<?php echo $_SESSION['user_naam']; ?>" readonly /></td>
</tr>
<tr>
<td>Email</td>
<td><label for="email"></label>
<input name="email" type="text" id="email" value="<?php echo $_SESSION['user_email']; ?>" readonly /></td>
</tr>
<tr>
<td>Week </td>
<td><label for="week"></label>
<label for="week2"></label>
<select name="week" size="1" id="week">
<option selected>Week1</option>
<option>Week2</option>
<option>Week3</optin>
<option>Week4</option>
<option>Week5</option>
</select></td>
</tr>
<tr>
<td> </td>
<td><input type="checkbox" name="beschikbaarheid" id="beschikbaarheid">
<label for="beschikbaarheid"></label>
Standaard beschikbaarheid</td>
</tr>
</table>
<br />
<table width="209" border="0">
<tr>
<td width="117">Maandag</td>
<td width="25"><input type="checkbox" name="maochtend" id="maochtend" />
<label for="maochtend"></label></td>
<td width="26"><input type="checkbox" name="mamiddag" id="maochtend2" /></td>
<td width="23"><input type="checkbox" name="maavond" id="maavond" /></td>
</tr>
<tr>
<td>Dinsdag</td>
<td><input type="checkbox" name="maochtend2" id="diochtend" /></td>
<td><input type="checkbox" name="dimiddag" id="dimiddag" /></td>
<td><input type="checkbox" name="diavond" id="diavond" /></td>
</tr>
<tr>
<td>Woensdag</td>
<td><input type="checkbox" name="woochtend" id="woochtend" /></td>
<td><input type="checkbox" name="womiddag" id="womiddag" /></td>
<td><input type="checkbox" name="woavond" id="woavond" /></td>
</tr>
<tr>
<td>Donderdag</td>
<td><input type="checkbox" name="doochtend" id="doochtend" /></td>
<td><input name="domiddag" type="checkbox" id="domiddag" /></td>
<td><input type="checkbox" name="doavond" id="doavond" /></td>
</tr>
<tr>
<td>Vrijdag</td>
<td><input type="checkbox" name="vrochtend" id="vrochtend" /></td>
<td><input type="checkbox" name="vrmiddag" id="vrmiddag" /></td>
<td><input type="checkbox" name="vravond" id="vravond" /></td>
</tr>
<tr>
<td>Zaterdag</td>
<td><input type="checkbox" name="zaochtend" id="zaochtend" /></td>
<td><input type="checkbox" name="zamiddag" id="zamiddag" /></td>
<td><input type="checkbox" name="zaavond" id="zaavond" /></td>
</tr>
</table>
<p>
<input type="submit" name="Verzenden" id="Verzenden" value="Submit" />
</p>
<p> </p>
</form>
</body>
</html>
</div>
<p class="c">(c) 2013 <a href="http://www.clinkmedia.nl">Marvin Duivestein</a></p>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-2929326-25");
pageTracker._trackPageview();
} catch(err) {}</script>
</body>
</html>
/*
php login system
(c) Michael Zelensky miha.in 2012
*/
include_once ('inc/start.inc');
?><!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
<script src="/js/app.js" type="text/javascript"></script>
<link rel="stylesheet" href="/css/style.css" type="text/css" />
</head>
<body>
<h1> 1.0</h1>
<p><a href="index.php">Home</a> <a href="beschikbaarheid.php">Beschikbaarheid</a>
<?
if (!isset($_SESSION['user_id'])) {
$display = "display:none";
?>
<div id="login">
Login:
<br>
<form id="form_login">
<input type="text" name="login_email" class="login_inactive"/>
<input type="password" name="login_password" class="login_inactive"/>
<a href="#" id="form_login_submit" class="form_button">Submit</a> <img src="/img/ajax-loader.gif" style="display:none" id="login_loader">
<div id="login_error" style="display:none" class="login_error">Wrong email/password!</div>
<div id="not_confirmed_error" style="display:none" class="login_error">Registration not complete! <a href="/register/resend.php">Resend confirmation email</a></div>
<br>
<a href="/register/reminder.php">Forgot password?</a> <a href="/register/">Register</a>
</form>
</div>
<? } else {
$display = "";
}
?>
<div id="loggedin" style="<?=$display?>">
<p>Hallo , <a href="#" id="user_naam">
<?=$_SESSION['user_naam']?>
</a><a href="#" id="user_logout" class="logout_link">Logout</a>
</p>
<body>
<form id="form1" name="form1" method="post" action="verstuur.php">
<p> </p>
<table width="325" border="0">
<tr>
<td width="42">Naam</td>
<td width="273"><input name="naam" type="text" id="naam" value="<?php echo $_SESSION['user_naam']; ?>" readonly /></td>
</tr>
<tr>
<td>Email</td>
<td><label for="email"></label>
<input name="email" type="text" id="email" value="<?php echo $_SESSION['user_email']; ?>" readonly /></td>
</tr>
<tr>
<td>Week </td>
<td><label for="week"></label>
<label for="week2"></label>
<select name="week" size="1" id="week">
<option selected>Week1</option>
<option>Week2</option>
<option>Week3</optin>
<option>Week4</option>
<option>Week5</option>
</select></td>
</tr>
<tr>
<td> </td>
<td><input type="checkbox" name="beschikbaarheid" id="beschikbaarheid">
<label for="beschikbaarheid"></label>
Standaard beschikbaarheid</td>
</tr>
</table>
<br />
<table width="209" border="0">
<tr>
<td width="117">Maandag</td>
<td width="25"><input type="checkbox" name="maochtend" id="maochtend" />
<label for="maochtend"></label></td>
<td width="26"><input type="checkbox" name="mamiddag" id="maochtend2" /></td>
<td width="23"><input type="checkbox" name="maavond" id="maavond" /></td>
</tr>
<tr>
<td>Dinsdag</td>
<td><input type="checkbox" name="maochtend2" id="diochtend" /></td>
<td><input type="checkbox" name="dimiddag" id="dimiddag" /></td>
<td><input type="checkbox" name="diavond" id="diavond" /></td>
</tr>
<tr>
<td>Woensdag</td>
<td><input type="checkbox" name="woochtend" id="woochtend" /></td>
<td><input type="checkbox" name="womiddag" id="womiddag" /></td>
<td><input type="checkbox" name="woavond" id="woavond" /></td>
</tr>
<tr>
<td>Donderdag</td>
<td><input type="checkbox" name="doochtend" id="doochtend" /></td>
<td><input name="domiddag" type="checkbox" id="domiddag" /></td>
<td><input type="checkbox" name="doavond" id="doavond" /></td>
</tr>
<tr>
<td>Vrijdag</td>
<td><input type="checkbox" name="vrochtend" id="vrochtend" /></td>
<td><input type="checkbox" name="vrmiddag" id="vrmiddag" /></td>
<td><input type="checkbox" name="vravond" id="vravond" /></td>
</tr>
<tr>
<td>Zaterdag</td>
<td><input type="checkbox" name="zaochtend" id="zaochtend" /></td>
<td><input type="checkbox" name="zamiddag" id="zamiddag" /></td>
<td><input type="checkbox" name="zaavond" id="zaavond" /></td>
</tr>
</table>
<p>
<input type="submit" name="Verzenden" id="Verzenden" value="Submit" />
</p>
<p> </p>
</form>
</body>
</html>
</div>
<p class="c">(c) 2013 <a href="http://www.clinkmedia.nl">Marvin Duivestein</a></p>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-2929326-25");
pageTracker._trackPageview();
} catch(err) {}</script>
</body>
</html>
Gewijzigd op 10/05/2013 13:16:44 door Raoul D
Ik hoop dat hier niks belangrijks in staat.
Een .inc bestand is namelijk gewoon door iedere bezoeker te lezen.
Plaats je code aub even tussen [code.] [/code.] tags (zonder . )
@-SanThe- in start.inc staan de database gegevens, hoe zou ik dit kunnen vervangen.
start.inc
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
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
<?
/*
PHP Application start file, included in every php script
lists all includes and does all standard logic
NO OUTPUT, NO HTML, NO TEMPLATES here!
(c) Michael Zelensky 2012
www.miha.in
*/
//includes
include_once ('mysql.class.php');
include_once ('func.inc');
//global vars
$GV = array(
'app_name'=> 'PHP login',
'app_url'=> '',
'db_host' => 'localhost',
'db_name' => '',
'db_user' => '',
'db_pass' => '',
'DB' => null
);
//starting session
if (isset($_REQUEST[session_name()])) session_start();
//connecting DB
$DB = new DB($GV['db_host'], $GV['db_name'], $GV['db_user'], $GV['db_pass']);
$DB->connect();
$GV['DB'] = $DB;
/* EOS =) */
?>
/*
PHP Application start file, included in every php script
lists all includes and does all standard logic
NO OUTPUT, NO HTML, NO TEMPLATES here!
(c) Michael Zelensky 2012
www.miha.in
*/
//includes
include_once ('mysql.class.php');
include_once ('func.inc');
//global vars
$GV = array(
'app_name'=> 'PHP login',
'app_url'=> '',
'db_host' => 'localhost',
'db_name' => '',
'db_user' => '',
'db_pass' => '',
'DB' => null
);
//starting session
if (isset($_REQUEST[session_name()])) session_start();
//connecting DB
$DB = new DB($GV['db_host'], $GV['db_name'], $GV['db_user'], $GV['db_pass']);
$DB->connect();
$GV['DB'] = $DB;
/* EOS =) */
?>
Toevoeging op 09/05/2013 13:15:25:
Wie zou me kunnen en willen helpen?