-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathregistration.php
155 lines (144 loc) · 5.33 KB
/
registration.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
<?php require 'connection.php';?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="bootstrap-3.3.6-dist/css/bootstrap.css" type="text/css">
<title>Registrazione</title>
<script>
function showClasses(str) {
if (str == "") {
document.getElementById("classe").innerHTML = "";
return;
} else {
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else {
// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("classe").innerHTML = xmlhttp.responseText;
}
};
xmlhttp.open("GET","ajax_get_class.php?q="+str,true);
xmlhttp.send();
}
}
</script>
</head>
<body>
<div class="content">
<div class="col-sm-11 col-sm-offset-1">
<form class="form-inline" role="form">
<fieldset class="fieldset">
<div class="row">
<div class="col-sm-6 form-group">
<label for="user" class="col-sm-4">Username:</label>
<input type="text" class="col-sm-2 form-control" name="user" id="user" required>
</div>
<div class="col-sm-6 form-group">
<label for="pwd" class="col-sm-4">Password:</label>
<input type="password" class="col-sm-2 form-control" name="password" id="pwd" required>
</div>
</div>
<?php
$reg_detail="";
/*switch($_POST["reg_mode"]){
// Studenti
case 1:{
$reg_detail.=
"<div class=\"form-group\">".
"<label for=\"name\">Nome:</label>".
"<input type=\"text\" class=\"form-control\" name=\"nome\" id=\"name\">".
"</div>".
"<div class=\"form-group\">".
"<label for=\"surname\">Cognome:</label>".
"<input type=\"password\" class=\"form-control\" name=\"cognome\" id=\"surname\">".
"</div>";
$reg_detail.=
"<div class=\"form-group\">".
"<label for=\"specializzazione\">Specializzazione:</label>".
"<select class=\"form-control\" name=\"specializzazione\" id=\"specializzazione\">";
$query = "SELECT * FROM Specializzazioni";
$result = $conn->query($query);
while($row = $result->fetch_assoc()){
echo "<select value=".$row["ID_Specializzazione"].">".$row["Descrizione"]."</select>";
}
$reg_detail.="</select></div>";
break;
}
// Docenti
case 2:{
//$reg_detail=
"<div class=\"form-group\">".
"<label for=\"name\">Username:</label>".
"<input type=\"text\" class=\"form-control\" name=\"nome\" id=\"name\">".
"</div>".
"<div class=\"form-group\">".
"<label for=\"surname\">Password:</label>".
"<input type=\"password\" class=\"form-control\" name=\"cognome\" id=\"surname\">".
"</div>";
break;
}
// Enti/Aziende
case 3:{
break;
}
default:{
break;
}
}*/
// NOME COGNOME
$reg_detail.=
"<div class=\"row\">".
"<div class=\"col-sm-6 form-group\">".
"<label for=\"name\" class=\"col-sm-4\">Nome:</label>".
"<input type=\"text\" class=\"col-sm-2 form-control\" name=\"nome\" id=\"name\" required>".
"</div>".
"<div class=\"col-sm-6 form-group\">".
"<label for=\"surname\" class=\"col-sm-4\">Cognome:</label>".
"<input type=\"text\" class=\"col-sm-2 form-control\" name=\"cognome\" id=\"surname\" required>".
"</div>".
"</div>";
// SPECIALIZZAZIONE
$reg_detail.=
"<div class=\"row\">".
"<div class=\"col-sm-6 form-group\">".
"<label for=\"specializzazione\" class=\"col-sm-4\">Specializzazione:</label>".
"<select class=\"col-sm-2 form-control\" name=\"specializzazione\" id=\"specializzazione\" onchange=\"showClasses(this.value)\" required>".
"<option selected=\"selected\"></option>";
$query = "SELECT * FROM Specializzazioni";
$result = $conn->query($query);
while($row = $result->fetch_assoc()){
$reg_detail.= "<option value=".$row["ID_Specializzazione"].">".$row["Descrizione"]."</option>";
}
$reg_detail.="</select>"."</div>";
// CLASSE
$reg_detail.=
"<div class=\"col-sm-6 form-group\">".
"<label for=\"classe\" class=\"col-sm-4\">Classe:</label>".
"<select class=\"col-sm-2 form-control\" name=\"classe\" id=\"classe\" required>".
"<option selected=\"selected\"></option>";
/*
$query = "SELECT * FROM Classi";
$result = $conn->query($query);
while($row = $result->fetch_assoc()){
$reg_detail.= "<option value=".$row["ID_Classe"].">".$row["ID_Classe"]."</option>";
}
*/
$reg_detail.="</select>"."</div>"."</div>";
echo $reg_detail;
?>
</fieldset>
</form>
</div>
</div>
</body>
<script>
</script>
</html>