Bjr a tous,
J'ai entrain de faire un code qui sert a un instructor de preciser si un etudiant present ou absent durant la matiere, tous marche correctment, le login, l'insertion des matieres, des instructeur, les etudiant, et la jointure des etudiant avec les matiere encore marche correctement, mais lorsque je veux inserer la presence d'une matiere, rien et ajouter. Le code est:
La premier page qui precise qu'elle matiere on va faire la presence.
La deuxieme c'est lorsqu'on passe a preciser a l'aide dune table, pour chauqe etudiant de cette matiere si il est present ou non.
Est-ce que vous pouvez m'aidr a trouver pourquoi rien et ajouter ?
Merci.
---Page 1---
---Page 2---
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 <? session_start(); if(!session_is_registered(myusername)){ header("location:index.html"); } ?> <html> <head> <title></title> </head> <body> <div id="header"></div> <BR/> <BR/> <BR/> <BR/> <?php $host="localhost"; // Host name $username="root"; // Mysql username $password=""; // Mysql password $db_name="***"; // Database name $tbl_name="***"; // Table name 1 // Connect to server and select database. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $coname=$_POST['coname']; // Retrieve data from database $sql="SELECT * FROM $tbl_name , student WHERE student_id=id and course_id=$coname"; $result=mysql_query($sql); ?> <form name="form" method="POST" action="at_insert.php"> <input type="hidden" name="coid" id="coid" value="<? echo $coname; ?>"> <table width="398" border="0" align="center" cellpadding="0" cellspacing="1"> <tr> <td><CENTER> <table border="1" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"> <tr> <td>Student Name</td> <td>Attend Or Not</td> <?php // Start looping rows in mysql database. $i = 0; while($rows=mysql_fetch_array($result)){?> <tr> <td><?php echo $rows['name']; ?><input type="hidden" name="stid<?echo$i?>" id="stid<?echo$i?>" value="<?php echo $rows['student_id']; ?>"></td> <td><select name="attend<?echo$i?>" id="attend<?echo$i?>"> <option value = "1" >ATTEND</option> <option value = "0" >NOT ATTEND</option> </td></tr></select> <?php $i++; } ?> <input type="hidden" name="count" id="count" value="<?php echo $i ?>"> <?// close while loop // close connection mysql_close(); ?></td> </tr> </table> </BR> Date :<FONT COLOR="red" SIZE="1"> (YYYY-MM-DD) </FONT><input name="date" type="text" id="date"> <input type="submit" name="Submit" value="Take"></CENTER> </form> </table> <div id="footer"></div> </body> </html>
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 <? session_start(); if(!session_is_registered(myusername)){ header("location:index.html"); } ?> <?php $host="localhost"; // Host name $username="root"; // Mysql username $password=""; // Mysql password $db_name="***"; // Database name $tbl_name="***"; // Table name // Connect to server and select database. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // Get values from form $i = $_POST['count']; $j = 0; while ( $j < $i ) { $course_id=$_POST['coid']; $student_id=$_POST[stid.$j]; $date=$_POST['date']; $attend=$_POST[attend.$j]; // Insert data into mysql $sql="INSERT INTO $tbl_name(course_id, student_id, date, attend)VALUES('$course_id', '$student_id', '$date', '$attend')"; $result=mysql_query($sql); $j ++ ; } // if successfully insert data into database, displays message "Successful". if($result){ header("location:done.php");} else { header("location:at_false.php"); } // close connection mysql_close(); ?>
Partager