-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathajaxmat.php
137 lines (110 loc) · 3.8 KB
/
ajaxmat.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
<html>
<head> </head>
<body>
<script>
function afficher(str){
if (str == "choisir le nom de matiére ") {
document.getElementById("result").innerHTML = "choisir un id valide";
return;
} else {
if (window.XMLHttpRequest) {
// code for IE7+ ? Firefox , Chrome, Opéra, Safari
xmlhttp = new XMLHttpRequest();
} else {
// code for IE6 , IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function(){
if ( this.readyState == 4 && this.status == 200 ) {
document.getElementById("result").innerHTML=this.responseText;
}
};
xmlhttp.open("GET","ajaxmat.php?nom="+str,true);
xmlhttp.send();
}
}
</script>
</head>
<table>
<tr><td><label> choisir votre id </label></td>
<td> <select onchange="afficher(this.value)">
<option>choisir numero de id</option>
<?php
$con=mysqli_connect("localhost","root","","emplois"); ;
$res=mysqli_query($con,"select * from seance");
while ($r=mysqli_fetch_array($res,MYSQLI_NUM))
{ echo '<option>'.$r[1].'</option>' ; }{ echo '<option>'.$r[2].'</option>' ; }{ echo '<option>'.$r[3].'</option>' ; }
?>
</select> </td> </tr>
</table>
<div id="result"> les informations seront listées içi </div>
</html>
<form method="POST" action="emploi.php">
<?php
$nom=$_GET["nom"];
$con=mysqli_connect("localhost","root","","emplois");
$res=mysqli_query($con,"select * from matiere where nom_matiere='$nom'");
if($r=mysqli_fetch_array($res)){
?>
<table>
<tr><td><label>Votre nom</label></td>
<td><input type="text" name="nom" id="nom" value="<?php echo $r[1]; ?>" /> </td>
</tr>
<tr><td><label>Votre nomens</label></td>
<td><input type="text" name="nomens" id="nomens" value="<?php echo $r[2]; ?>" /> </td>
</tr>
<tr><td><label>classe</label></td>
<td><input type="text" name="classe" id="classe" value="<?php echo $r[3]; ?>" /> </td>
</tr>
<tr><td><label>groupe</label></td>
<td><input type="text" name="groupe" id="groupe" value="<?php echo $r[4]; ?>" /> </td>
</tr>
<tr><td>
<input type="submit" name="modif" id="modif" value="Modifier"/> </td>
<td>
<input type="submit" name="supp" id="supp" value="Supprimer"/> </td>
</tr>
</table>
<?php } ?>
<!-- <input type="text" id="nom" name="nom" value="<?php echo $_GET["nom"] ; ?>" /> -->
</form>
<head id="modifmat">
<!-- <script>
function afficher(str){
if (str == "choisir le nom de matiére ") {
document.getElementById("result").innerHTML = "choisir un id valide";
return;
} else {
if (window.XMLHttpRequest) {
// code for IE7+ ? Firefox , Chrome, Opéra, Safari
xmlhttp = new XMLHttpRequest();
} else {
// code for IE6 , IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function(){
if ( this.readyState == 4 && this.status == 200 ) {
document.getElementById("result").innerHTML=this.responseText;
}
};
xmlhttp.open("GET","ajaxmat.php?nom="+str,true);
xmlhttp.send();
}
}
</script>
-->
</head>
<table>
<tr><td><label> choisir le nom de matiére</label></td>
<td> <select onchange="afficher(this.value)">
<option>choisir le nom de matiére</option>
<?php
$con=mysqli_connect("localhost","root","","emplois"); ;
$res=mysqli_query($con,"select * from seance");
while ($r=mysqli_fetch_array($res,MYSQLI_NUM))
{ echo '<option>'.$r[1].'</option>' ; }
?> </select> </td> </tr>
</table>
<div id="result"> les informations seront listées içi </div>
</body>
</html>