a la création d'un contrat je dois vérifier que dans la periode saisie la kiosque mentionné ne doit pas être déja loué dans la même periode. Pour cela j'ai essayé d'écrire ce code en php.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
 if (!empty ( $_POST['nom_champs_date2'])){
$reqd= "select * from location where  ref_kios='". mysql_real_escape_string($_POST['refk']) ."' and date_fin >'". strtotime($_POST['nom_champs_date2']) ."' and date_deb >'". strtotime($_POST['nom_champs_date']) ."'";
$resd= mysql_query($reqd) ;
if (!$resd) {
   echo "Could not successfully run query ($reqd) from DB: " . mysql_error();
  }
if (mysql_num_rows($resd) == 0) {
   echo "<script>alert('Erreur: impossible de créer un contrat dans cette periode avec cette kiosque !!');</script>";}   
   }
Le problème que rien ne s'affiche. Voilà le code du formulaire contrat:
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
<form name="contrat" method="post" action="">
<table width="440" border="0">
  <tr>
    <td width="125">Nom entreprise </td>
    <td width="299"><input name="nome" type="text" style="font-family:Courier New;font-size:12px"/></td>
  </tr>
  <tr>
    <td>R&eacute;f&eacute;rence kiosque </td>
    <td><input name="refk" type="text" style="font-family:Courier New;font-size:12px" /></td>
  </tr>
  <tr>
    <td>Date début location</td>
    <td><input type="text" id="nom_champs_date" style="font-family:Courier New;font-size:12px" name="nom_champs_date" value=""><a href="javascript:popupwnd('calendrier.php?idcible=nom_champs_date&langue=fr','no','no','no','yes','yes','no','50','50','450','280')" target="_self"><img src="calendrier.gif" id="Image1" alt="" align="top" border="0" style="width:26px;height:26px;"></a></td>
  </tr>
    <tr>
    <td>Date fin location</td>
    <td><input type="text" id="nom_champs_date2" style="font-family:Courier New;font-size:12px" name="nom_champs_date" value=""><a href="javascript:popupwnd('calendrier.php?idcible=nom_champs_date2&langue=fr','no','no','no','yes','yes','no','50','50','450','280')" target="_self"><img src="calendrier.gif" id="Image1" alt="" align="top" border="0" style="width:26px;height:26px;"></a></td>
  </tr>
    <tr>
    <td>Prix</td>
    <td><input name="prix" type="text" style="font-family:Courier New;font-size:12px"/></td>
  </tr>
     <tr>
    <td><input name="verifier" type="submit" value="v&eacute;rifier"/></td>
    <td>&nbsp;</td>
  </tr> 
</table>
 
</form>