Bonjour,
Je ne comprends pas, j'essaie d'intégrer les absences de mes consultants dans ma base de données et quand je coche les checkbox's et que j'envoi le formulaire tous mes champs reste en "Null" dans ma base de données.
Pourriez vous m'aider svp ?
Désolé je suis débutant et mon code est un peu fouilli, car j'ai fais un mix de tout ce que j'ai trouvé sur le forum, mais je n'arrive pas à mettre cela en place.
Merci d'avance.
Tout d'avoir voici ma base de données :
Voici mon code :
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 -- phpMyAdmin SQL Dump -- version 3.4.10.1deb1 -- http://www.phpmyadmin.net -- -- Client: localhost -- Généré le : Jeu 28 Septembre 2017 à 21:35 -- Version du serveur: 5.5.54 -- Version de PHP: 5.4.45-4+deprecated+dontuse+deb.sury.org~precise+1 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; -- -- Base de données: `stp_tool` -- -- -------------------------------------------------------- -- -- Structure de la table `wp_planning_taches` -- CREATE TABLE IF NOT EXISTS `wp_planning_taches` ( `ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `id_planning` bigint(20) NOT NULL, `date_planning` date NOT NULL, `auteur` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `id_consultant` bigint(20) NOT NULL, `consultant` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `inbound_am` text COLLATE utf8mb4_unicode_ci, `blancos_am` text COLLATE utf8mb4_unicode_ci, `callpicking1_am` text COLLATE utf8mb4_unicode_ci, `callpicking2_am` text COLLATE utf8mb4_unicode_ci, `contactmailbox_am` text COLLATE utf8mb4_unicode_ci, `quality_am` text COLLATE utf8mb4_unicode_ci, `sicknessfullfilment_am` text COLLATE utf8mb4_unicode_ci, `socdoc_am` text COLLATE utf8mb4_unicode_ci, `teleportel_am` text COLLATE utf8mb4_unicode_ci, `malade_am` text COLLATE utf8mb4_unicode_ci, `va_am` text COLLATE utf8mb4_unicode_ci, `adv_am` text COLLATE utf8mb4_unicode_ci, `petit_chomage_am` text COLLATE utf8mb4_unicode_ci, `inbound_pm` text COLLATE utf8mb4_unicode_ci, `blancos_pm` text COLLATE utf8mb4_unicode_ci, `callpicking1_pm` text COLLATE utf8mb4_unicode_ci, `callpicking2_pm` text COLLATE utf8mb4_unicode_ci, `contactmailbox_pm` text COLLATE utf8mb4_unicode_ci, `quality_pm` text COLLATE utf8mb4_unicode_ci, `sicknessfullfilment_pm` text COLLATE utf8mb4_unicode_ci, `socdoc_pm` text COLLATE utf8mb4_unicode_ci, `teleportel_pm` text COLLATE utf8mb4_unicode_ci, `malade_pm` text COLLATE utf8mb4_unicode_ci, `va_pm` text COLLATE utf8mb4_unicode_ci, `adv_pm` text COLLATE utf8mb4_unicode_ci, `petit_chomage_pm` text COLLATE utf8mb4_unicode_ci, PRIMARY KEY (`ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=0 ; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
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
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 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr"> <head> <meta charset="utf-8" /> <link rel="stylesheet" href="http://www.stp-tool.be/wp-content/pages/includes/style.css" /> </head> <?php header('Content-type: text/html; charset=utf-8'); include('/var/www/stp_tool/wp-content/pages/includes/fonctions.php'); connexionbdd(); global $current_user; get_currentuserinfo(); // on crée la requête SQL $sql_consultants = "SELECT * FROM wp_consultants ORDER BY consultant ASC"; // on envoie la requête AM $req_consultants = mysql_query($sql_consultants) or die('Erreur SQL !<br>'.$sql_consultants.'<br>'.mysql_error()); //on obtient le resultat AM $res_consultants = mysql_num_rows($req_consultants); $prepa_date_rechercher= date("d-m-Y"); $date_rechercher = date("Y-m-d", strtotime(str_replace('/', '-', $prepa_date_rechercher))); ?> <form method="post" action="" enctype="multipart/form-data"> <center><u>Absences du matin le <?php echo $prepa_date_rechercher; ?> ?</u></center> <table id="Table" class="tablecenter"> <tr> <td> <center>Consultant :</center> </td> <td> <center>Malade ?</center> </td> <td> <center>VA ?</center> </td> <td> <center>ADV ?</center> </td> <td> <center>Petit chomage ?</center> </td> </tr> <br /><br /> <?php while($row = mysql_fetch_array($req_consultants)) { ?> <tr> <td> <center><?php echo $row["consultant"]; ?></center> <input type="hidden" name="consultant" value="<?php echo $row["consultant"]; ?>" /> </td> <td> <center><input type="checkbox" id="malade_am" name="malade_am[]" /></center> </td> <td> <center><input type="checkbox" id="va_am" name="va_am[]" /></center> </td> <td> <center><input type="checkbox" id="adv_am" name="adv_am[]" /></center> </td> <td> <center><input type="checkbox" id="petit_chomage_am" name="petit_chomage_am[]" /></center> </td> </tr> <?php $date_planning=$date_rechercher; $auteur=$current_user->display_name; $consultant=$row["consultant"]; } ?> </table> <br /><br /> <center><p><input type="submit" name="etape1" value="Passer à l'étape suivante" /></p></center> </form> <?php if (isset($_POST['etape1'])){ // if send form update data into database foreach ($_POST['malade_am'] as $malade_am) { $absences_malade_am = mysql_real_escape_string($malade_am); mysql_query("UPDATE wp_planning_taches SET malade_am = '$malade_am' WHERE consultant = '$consultant' AND date_planning = '$date_planning'") or die(mysql_error()); } foreach ($_POST['va_am'] as $va_am) { $absences_va_am = mysql_real_escape_string($va_am); mysql_query("UPDATE wp_planning_taches SET va_am = '$va_am' WHERE consultant = '$consultant' AND date_planning = '$date_planning'") or die(mysql_error()); } foreach ($_POST['adv_am'] as $adv_am) { $absences_adv_am = mysql_real_escape_string($adv_am); mysql_query("UPDATE wp_planning_taches SET adv_am = '$adv_am' WHERE consultant = '$consultant' AND date_planning = '$date_planning'") or die(mysql_error()); } foreach ($_POST['petit_chomage_am'] as $petit_chomage_am) { $absences_petit_chomage_am = mysql_real_escape_string($petit_chomage_am); mysql_query("UPDATE wp_planning_taches SET petit_chomage_am = '$petit_chomage_am' WHERE consultant = '$consultant' AND date_planning = '$date_planning'") or die(mysql_error()); } echo "<center>On passe aux absences de l'après-midi.</center>"; header('Refresh: 10; url=creer_etape2.php'); } ?>
Partager