Bonjour,
Je suis tombé sur un problème dont je comprend pas le pourquoi, j'ai un formulaire avec un champ heure de début et heure de fin, c'est un champ texte banal... je veux l'enregistrer par POST et aucun Update dans la base ne se fait a part une remise a Zéro. si je passe par la l'heure courante cela marche. mais ce n'est pas ce que je veux bien évidemment. j'ai essayé également avec un Timepicker, même problème...
je formate mon heure comme cela 00:00:00, rien de plus basic, si je passe par la fonction $autom_depart=date("H:i:s"); cela fonctionne...
Voila le formulaire
Et le script d'update MySQL dans un champ TIME
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 <form action="<?php echo $_SERVER["PHP_SELF"];?>?lang=<?php echo $lang ?>&user=<?php echo $userID ?>&save=1" method="post" enctype="multipart/form-data" name="form1" id="form1"> <table width="90%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="<?php echo $couleur_ligne; ?>" background="<?php echo $couleur_ligne ?>"> <tr> <td width="14%"></td> <td width="15%"><font size="2" face="Arial"><?php echo $nom_pays ?></font></td> <td width="15%"><input name="autom_depart" type="text" id="autom_depart" onblur="this.style.backgroundColor='#ffffff'" onfocus="this.style.backgroundColor='#FFFFBF';" style="width:70px; -moz-border-radius: 4px;-webkit-border-radius: 4px;border-radius: 4px;" value="<?php echo $autom_depart ?>" /> </td> <td width="16%"><input name="autom_fin" type="text" id="autom_fin" onblur="this.style.backgroundColor='#ffffff'" onfocus="this.style.backgroundColor='#FFFFBF';" style="width:70px; -moz-border-radius: 4px;-webkit-border-radius: 4px;border-radius: 4px;" value="<?php echo $autom_fin ?>" /></td> <td width="11%"><?php if($userID_verif==$userID){?>En ligne<?php } else { ?>Hors ligne<? } ?></td> <td width="19%"> <table width="100%" border="0" cellspacing="1" cellpadding="1"> <tr> <td width="10%"> </td> </tr> </table></td> <td width="10%"> <input type="submit" name="Submit" value="Envoyer" /> </td> </tr> </table> </form>
Faut'il un formatage particulier pour les TIME Mysql?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 $save=$_GET['save']; $user=$_GET['user']; if($save==1){ $autom_depart=$_POST['autom_depart']; //$autom_fin=$_POST['autom_fin']; $autom_activ='1'; $result3 = mysql_query("UPDATE users SET autom_depart='$autom_depart' WHERE userID='$user'"); };
Merci
Partager