bonjour,
je suis debutant en php
j'ai un probleme avec la gestion de dates avec la base de données
meme si le inputtext de l date est rempli j'ai dans la base de données : le champs est vide

voila la page php :
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
<?php
session_start();
if (!array_key_exists("user", $_SESSION)) {
    header('Location: index.php');
    exit;
}
require_once("Includes/db.php");
$wisherID = WishDB::getInstance()->get_wisher_id_by_name($_SESSION['user']);
 
$wishDescriptionIsEmpty = false;
if ($_SERVER['REQUEST_METHOD'] == "POST") {
    if (array_key_exists("back", $_POST)) {
        header('Location: editWishList.php');
        exit;
    } else
    if ($_POST['wish'] == "") {
        $wishDescriptionIsEmpty = true;
    } else if ($_POST["wishID"] == "") {
        WishDB::getInstance()->insert_wish($wisherID, $_POST["wish"], $_POST["dueDate"]);
        header('Location: editWishList.php');
        exit;
    } else if ($_POST["wishID"] != "") {
        WishDB::getInstance()->update_wish($_POST["wishID"], $_POST["wish"], $_POST["dueDate"]);
        header('Location: editWishList.php');
        exit;
    }
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>	
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link type="text/css" href="jquery-ui-1.8.24.custom/css/smoothness/jquery-ui-1.8.24.custom.css" rel="stylesheet" />
		<script type="text/javascript" src="jquery-ui-1.8.24.custom/js/jquery-1.8.0.min.js"></script>
		<script type="text/javascript" src="jquery-ui-1.8.24.custom/js/jquery-ui-1.8.24.custom.min.js"></script>
		<script type="text/javascript" src="jquery-ui-1.8.24.custom\development-bundle\ui\i18n\jquery.ui.datepicker-fr.js"></script>
		<script type="text/javascript">
			$(function() {
		$.datepicker.setDefaults( $.datepicker.regional[ "" ] );
		$( "#datepicker" ).datepicker( $.datepicker.regional[ "fr" ] );
 
	});			
		</script>
    </head>
    <body>
        <?php
        if ($_SERVER["REQUEST_METHOD"] == "POST")
            $wish = array("id" => $_POST["wishID"], "description" => $_POST["wish"], "due_date" => $_POST["dueDate"]);
        else
        if (array_key_exists("wishID", $_GET))
            $wish = mysqli_fetch_array(WishDB::getInstance()->get_wish_by_wish_id($_GET["wishID"]));
        else
            $wish = array("id" => "", "description" => "", "due_date" => "");
        ?>
        <form name="editWish" action="editWish.php" method="POST">
            <input type="hidden" name="wishID" value="<?php echo $wish["id"]; ?>" />
            <table>
                <tr>
                    <td>Describe your wish:</td>
                    <td><input type="text" name="wish"  value="<?php echo $wish['description']; ?>" /></td>
                    <td><?php if ($wishDescriptionIsEmpty) echo "Please enter description"; ?></td>
                </tr>
                <tr>
                    <td>When do you want to get it?</td>
 
					<td><input type="text" name="due_date" id="datepicker" value="<?php echo $wish['due_date']; ?>" /></td>
                </tr>                
            </table>
            <input type="submit" name="saveWish" value="Save Changes"/>
            <input type="submit" name="back" value="Back to the List"/>
 
        </form>
		je suis 
		</br>
 
    </body>
</html>
et voila les methodes de modification et insertion de date dans le fichier db.php :
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
function insert_wish($wisherID, $description, $dueDate) {
        $description = $this->real_escape_string($description);
        if ($duedate == '') {
            $this->query("INSERT INTO wishes (wisher_id, description)" .
                    " VALUES (" . $wisherID . ", '" . $description . "')");
        } else
            $this->query("INSERT INTO wishes (wisher_id, description, due_date)" .
                    " VALUES (" . $wisherID . ", '" . $description . "', '" . $dueDate . "')");
    }    
 
    public function update_wish($wishID, $description, $duedate) {
        $description = $this->real_escape_string($description);
        if ($duedate == null) {
            $this->query("UPDATE wishes SET description = '" . $description . "', due_date = NULL WHERE id = " . $wishID);
        } else
            $this->query("UPDATE wishes SET description = '" . $description . "', due_date = '" . $duedate . "' WHERE id = " . $wishID);
    }
pouvez vous me detectez l'erreur :
merci bien