Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
728 connectés 

  FORUM HardWare.fr
  Programmation
  PHP

  passage d'info d'une page a une autre

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

passage d'info d'une page a une autre

n°977529
francescu
youpee !!
Posté le 10-02-2005 à 12:10:31  profilanswer
 

bonjour,
voici ma premiere page : le formulaire
 

Code :
  1. <?
  2. include("./includes/connect.php3" );
  3.   header("Cache-Control: no-cache, must-revalidate" );          // HTTP/1.1
  4.   header("Pragma: no-cache" );                                  // HTTP/1.0
  5. //--------------------- recuperation des enregistrements bateaux locations--
  6. //---------------------------------------------------------------------
  7. //Mise à jour de action pour modification-----------------------------------
  8. if (isset($id))
  9.  $action = "modifier";
  10. //--------------------------------------------------------------------------  
  11. //Affichage des infos location----------------------------------------------
  12. if (($action == "modifier" ) ||($action=="update" ))
  13.    {
  14.  $query3= "select * from location where num_location = '$id'";
  15.    $result3 = mysql_query($query3);
  16.    $ligne1 = mysql_fetch_array($result3);
  17.  $loc = mysql_fetch_object($result3);
  18.     }
  19. ?>
  20. <HTML>
  21. <HEAD>
  22. <title>aaaa</title>
  23. </head>
  24. <body leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">
  25. <link rel="stylesheet" type="text/css" href="./includes/classe.css">
  26. <table width="894" height"672" border="0" cellspacing="0" cellpadding="0" >
  27.   <tr>
  28.     <td width="6" height="255">&nbsp;</td>
  29.     <td width="8" valign="top">&nbsp;</td>
  30.     <td width="880" height="255" colspan="3" align="center" valign="top" bgcolor="#FFFFFF" >
  31. <form action="detail_location.php3" name="form" method="post">
  32.         <table width="859" height="88%" border="0" align="left" cellpadding="1" cellspacing="1">
  33.           <tr>
  34.          <td width="131" bgcolor="#E6E8E8" height="26"><div align="left"><font face="Verdana" size="2">&nbsp;Nom location </font>
  35.            <input type="hidden" name="action" value="<?
  36.    if($action=="modifier" ) echo"update";
  37.      elseif($action=="nouveau" ) echo"nouveau"; ?>">
  38.       </div> </td>
  39.        
  40.   <td colspan="3" bgcolor="#E6E8E8"><font face="Verdana" size="2">
  41.    <input type="text" name="nom_location" size="35" value="<? if($action == "modifier" )  print"$ligne1[nom_location]"; ?>"
  42.     maxlength="35" >
  43.          </font></td>
  44.          <td width="91" height="26" bgcolor="#E6E8E8"><div align="center"><span class="Style15">Photo n&deg;1</span></div></td>
  45.          <td width="304" bgcolor="#E6E8E8"><input name="img_vue_grand" type="file" size="22"></td>
  46.           </tr>
  47.         <tr>
  48.         <td width="131" bgcolor="#F5F5F5" height="26"> <div align="left"><font face="Verdana" size="2">&nbsp;Type bateau </font>
  49.  </div></td>
  50.         <td colspan="3" bgcolor="#F5F5F5"><select name="type_bateau">
  51.           <option value="1" selected <? if(($action=="modifier" )||($action=="update" )) { if ($ligne1[type_bateau] == "Semi_rigide" ) echo" selected";}?>>Semi_rigide</option>
  52.           <option value="2" <? if (($action=="modifier" )||($action=="update" )) { if ($ligne1[type_bateau] == "Coque_Open" ) echo" selected";} ?>>Coque_Open</option>
  53.           <option value="3" <? if (($action=="modifier" )||($action=="update" )) { if ($ligne1[type_bateau] == "Habitable" ) echo" selected";} ?>> Habitable</option>
  54.         </select></td>
  55.         <td width="91" height="26" bgcolor="#F5F5F5"><div align="center"><span class="Style15">Photo n&deg;2</span></div></td>
  56.           <td width="304" height="26" bgcolor="#F5F5F5"><input name="img_vue_grand" type="file" size="22"></td>
  57.         </tr>
  58.           <tr>
  59.             <td width="131" bgcolor="#E6E8E8" height="26"> <div align="left"><font face="Verdana" size="2"> &nbsp;Puissance</font></div></td>
  60.             <td colspan="3" bgcolor="#E6E8E8"><font face="Verdana" size="2">
  61.               <input type="text" name="cv" size="12" value="<? if($action == "modifier" ) print"$ligne1[cv]";?>" maxlength="2">
  62.             </font></td>
  63.             <td width="91" height="26" bgcolor="#E6E8E8"> <div align="center"><span class="Style15">Photo n&deg;3</span></div></td>
  64.             <td width="304" height="26" bgcolor="#E6E8E8"><input name="img_vue_grand" type="file" size="22"></td>
  65.           </tr>
  66.           <tr>
  67.             <td width="131" bgcolor="#F5F5F5" height="24"> <div align="left"><font face="Verdana" size="2">
  68.             &nbsp;Longueur</font></div></td>
  69.             <td colspan="3" bgcolor="#F5F5F5"><font face="Verdana" size="2">
  70.               <input type="text" name="longueur" size="12" value="<? if($action == "modifier" ) print"$ligne1[longueur]";?>" maxlength="12">
  71.             </font></td>
  72.             <td height="24" colspan="2" bgcolor="#F5F5F5"> 
  73.             <div align="center" class="Style18"><font face="Verdana">Taille : 400pix X 300pix (largeur x hauteur)</font>                 </div></td>
  74.           </tr>
  75.           <tr>
  76.             <td width="131" height="24" bgcolor="#E6E8E8"> <div align="left"><font face="Verdana" size="2">
  77.             &nbsp;Nombre de &nbsp;personnes</font></div></td>
  78.             <td colspan="3" valign="top" bgcolor="#E6E8E8"><font face="Verdana" size="2">
  79. <input type="text" name="nb_personne" size="12" value="<? if($action == "modifier" ) print"$ligne1[nb_personne]";?>" maxlength="12">
  80.             </font></td>
  81.             <td rowspan="4" bgcolor="#E6E8E8"><div align="center"><font face="Verdana" size="2">Descriptions</font>                          </td>
  82.             <td rowspan="4" bgcolor="#E6E8E8">
  83. <textarea name="descriptions" cols="40" rows="6" wrap="VIRTUAL" ><? if($action == "modifier" ) echo"$ligne1[descriptions]";?>
  84.               </textarea></td>
  85.           </tr>
  86.           <tr>
  87.             <td width="131" height="24" bgcolor="#F5F5F5"><font size="2" face="Verdana">&nbsp;Caution</font></td>
  88.             <td colspan="3" valign="middle" bgcolor="#F5F5F5">
  89. <input type="text" name="caution" size="12"value="<? if($action == "modifier" ) print"$ligne1[caution]";?>" maxlength="12"></td>
  90.           </tr>
  91.           <tr>
  92.             <td width="131" bgcolor="#E6E8E8" height="24"> <div align="left"><span class="Style15">&nbsp;Tarif journee</span></div></td>
  93.             <td width="79" bgcolor="#E6E8E8"><font face="Verdana" size="2">
  94.    <input name="tarif_journee" type="text" size="12" maxlength="12" value="<? if($action == "modifier" ) print"$ligne1[tarif_journee]";?>">
  95.             </font></td>
  96.        <td width="138" bgcolor="#E6E8E8"><div align="center"><font size="2" face="Verdana">&nbsp;Tarif 3 jours </font></div></td>
  97.         <td width="97" bgcolor="#E6E8E8">
  98.  <input name="tarif_3" type="text" size="12" maxlength="12" value="<? if($action == "modifier" ) print"$ligne1[tarif_3]";?>"></td>
  99.           </tr>
  100.           <tr bgcolor="#E6E8E8">
  101.         <td height="30" bgcolor="#F5F5F5"><font size="2" face="Verdana">&nbsp;Tarif 7 jours </font></td>
  102.         <td bgcolor="#F5F5F5">
  103. <input type="text" name="tarif_7" size="12" value="<? if($action == "modifier" ) print"$ligne1[tarif_7]";?>" maxlength="12"></td>
  104.         <td bgcolor="#F5F5F5"><div align="center"><span class="Style15">Tarif 15 jours </span></div></td>
  105.         <td bgcolor="#F5F5F5">
  106.  <input name="tarif_15" type="text" size="12" maxlength="12" value="<? if($action == "modifier" ) print"$ligne1[tarif_15]";?>"></td>
  107.           </tr>
  108.           <tr bgcolor="cccccc">
  109.             <td height="26" bgcolor="cccccc"></td>
  110.             <td colspan="3" bgcolor="cccccc"><div align="right">
  111.          <input type="submit" name="envoyer" value="Envoyer">   </div></td>
  112.             <td height="26" colspan="2" bgcolor="cccccc">&nbsp;
  113.      </td>
  114.           </tr>
  115.         <input type="hidden" name="id" value="<? echo"$id";?>">
  116.         </table>
  117.     </form> </td> 
  118.   </tr>
  119. </table>
  120. </BODY></HTML>


 
 
et ma seconde, qui enregistre ou modifie...
 
 

Code :
  1. <?
  2.   header("Cache-Control: no-cache, must-revalidate" );          // HTTP/1.1
  3.   header("Pragma: no-cache" );                                  // HTTP/1.0
  4. include("./includes/connect.php3" );
  5. //--------------------- recuperation des enregistrments bateaux locations---------
  6. $query_aff="select * from location where num_location='$id'";
  7. $result_aff=mysql_query($query_aff);
  8. $obj_aff=mysql_fetch_object($result_aff);
  9. //---------------------------------------------------------------------
  10. //-------------------------------------------------------------------------------
  11. //enregistrer un mouveau bateau de location---------------------------------------------------  
  12. if($action == "nouveau" )
  13. {
  14. $query_nv= "insert into location (nom_location ,type_bateau ,cv ,longueur ,descriptions ,nb_personne ,caution ,tarif_journee, tarif_3,  tarif_7, tarif_15) values('$nom_location','$type_bateau','$cv','$longueur','$descriptions','$nb_personne','$caution','$tarif_journee','$tarif_3','$tarif_7', '$tarif_15')";
  15. $result_nv = mysql_query($query_nv);
  16. if(!$result_nv) echo "Erreur d'enregistrement";
  17. }
  18. //--------------------------------------------------------------------------
  19. //--------------------------------------------------------------------------
  20. //Mise à jour d'une location---------------------------------------------------  
  21. if($action == "update" )
  22. {
  23. $query_up="update location set nom_location='$nom_location', type_bateau='$type_bateau', cv='$cv', longueur='$longueur', descriptions='$descriptions', nb_personne='$nb_personne', caution='$caution' , tarif_journee='$tarif_journee', tarif_3='$tarif_3', tarif_7='$tarif_7', tarif_15='$tarif_15' where num_location='$id';";
  24. $result_up = mysql_query($query_up);
  25.    if(!$result_up) echo "Erreur d'enregistrement";
  26. }
  27. //---------------------------------------------------------------------------
  28. //---------------------------------------------------------------------------
  29. ?>
  30. <HTML>
  31. <HEAD>
  32. <title>Administration  </title>
  33. <body leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">
  34. <table width="913" height="54%"  border="0" align="left" cellpadding="0" cellspacing="0">
  35.    
  36.   <tr>
  37.         <td height="224" colspan="2" valign="top">
  38.  <table width="100%" border="1" cellspacing="0" cellpadding="0" bordercolor="#CCCCCC">
  39.           <tr bgcolor="#CCCCCC">&nbsp;  </td>
  40.             <td colspan="2" valign="middle"><a href="admin.php3" target="_parent" class="Style16 Style3">Accueil administration</a> </td>
  41.             <td width="46%" valign="middle"> <div align="center"><a href="saisie_location.php3?action=nvlocation" class="Style16 Style3">Ajouter une location </a>
  42.         </div> </td>
  43.           </tr>
  44.           <tr bgcolor="#F5F5F5">
  45.             <td colspan="2"><div align="center"><span class="Style16 Style17">Nom location</span></div></td>
  46.             <td colspan="2"><div align="center"><strong><font size="2" face="Verdana"> <? echo"$obj_aff->nom_location"; ?></font></strong></div></td>
  47.           </tr>
  48.           <tr bgcolor="#E6E8E8">
  49.             <td colspan="2"><div align="center"><span class="Style16 Style17">Type bateau </span></div></td>
  50.             <td colspan="2"><div align="center"><strong><font size="2" face="Verdana">
  51.                 <?  echo"$obj_aff->type_bateau"; ?>
  52.             </font></strong></div></td>
  53.           </tr>
  54.           <tr bgcolor="#F5F5F5">
  55.             <td colspan="2" valign="top"><div align="center"><span class="Style16 Style17">CV</span></div></td>
  56.             <td height="20" colspan="2" valign="top"><div align="center"><strong><font size="2" face="Verdana">
  57.                 <?  echo"$obj_aff->cv";?>
  58.             </font></strong></div></td>
  59.           </tr>
  60.           <tr bgcolor="#E6E8E8">
  61.             <td colspan="2" bgcolor="#E6E8E8"><div align="center"><span class="Style16 Style17">Longueur</span></div></td>
  62.             <td colspan="2"><div align="center"><strong><font size="2" face="Verdana">
  63.                 <?  echo"$obj_aff->longueur"; ?>
  64.             </font></strong></div></td>
  65.           </tr>
  66.           <tr bgcolor="#F5F5F5">
  67.             <td height="49" colspan="2"><div align="center"><span class="Style16 Style17">Descriptions</span></div></td>
  68.             <td colspan="2" align="left" valign="top"><div align="center"> <font size="2" face="Verdana">
  69.                 <? $descriptions=nl2br($obj_aff->descriptions); ?>
  70.                 <?  echo"$obj_aff->descriptions"; ?>
  71.             </font> </div></td>
  72.           </tr>
  73.           <tr bgcolor="#E6E8E8">
  74.             <td colspan="2"><div align="center"><span class="Style16 Style17">Nbre personne </span></div></td>
  75.             <td colspan="2"><div align="center"><strong><font size="2" face="Verdana"> <? echo"$obj_aff->nb_personne"; ?></font></strong></div></td>
  76.           </tr>
  77.           <tr bgcolor="#F5F5F5">
  78.             <td colspan="2"><div align="center"><span class="Style16 Style17">Caution</span></div></td>
  79.             <td colspan="2"><div align="center"><strong><font size="2" face="Verdana">
  80.                 <?  echo"$obj_aff->caution";?>
  81.             </font></strong></div></td>
  82.           </tr>
  83.           <tr bgcolor="#E6E8E8">
  84.             <td colspan="2" valign="top"><div align="center"><span class="Style16 Style17">Tarif journee</span></div></td>
  85.             <td height="20" colspan="2" valign="top"><div align="center"><strong><font size="2" face="Verdana"> <? echo"$obj_aff->tarif_journee"; ?></font></strong></div></td>
  86.           </tr>
  87.           <tr bgcolor="#F5F5F5">
  88.             <td colspan="2" valign="top"><div align="center"><span class="Style16 Style17">Tarif 3 jours </span></div></td>
  89.             <td height="22" colspan="2" valign="top"><font size="2" face="Verdana">
  90.               <div align="center"><strong>
  91.                 <?  echo"$obj_aff->tarif_3"; ?>
  92.               </strong></div>
  93.             </font></td>
  94.           </tr>
  95.           <tr bgcolor="#E6E8E8">
  96.             <td colspan="2" valign="top"><div align="center"><span class="Style16 Style17">Tarif 7 jours </span></div></td>
  97.             <td height="20" colspan="2" valign="top"><div align="center"><strong><font size="2" face="Verdana">
  98.                 <?  echo"$obj_aff->tarif_7"; ?>
  99.             </font></strong></div></td>
  100.           </tr>
  101.           <tr bgcolor="#F5F5F5">
  102.             <td colspan="2" valign="top" bgcolor="#F5F5F5"><div align="center"><span class="Style16 Style17">Tarif 15 jours </span></div></td>
  103.             <td height="20" colspan="2" valign="top"><div align="center"><strong><font size="2" face="Verdana"><? echo"$obj_aff->tarif_15"; ?></font></strong> </div></td>
  104.           </tr>
  105.         </table></td>
  106.       </tr>
  107.     </table>


 
 
 
et le probleme c'est quand j'enregistre un nouvel objet,je n'ai rien qui n'apparait dans la page detail (la 2eme), alors que qd je fais une modification, tout fonctionne... Je trouve pas le probleme... si vous pouvez m'aider... c'est volontiers...  
Merci  :sol:  
 
 
ps :Surtout mille excuses si ca fait brouillon comme ca...
 

mood
Publicité
Posté le 10-02-2005 à 12:10:31  profilanswer
 

n°977536
FlorentG
Unité de Masse
Posté le 10-02-2005 à 12:15:18  profilanswer
 

Ouch le brouillon :D Surtout le code HTML, j'ai jamais vu un truc pareil (mix de <div>, de <font>, des classe avec des noms trèèèès mal choisis ('style16' et 'style17', c'est quoiiii) :cry: Des tableaux partout, des trucs, ouch :eek:
 
Refait tout ça au propre, parce que là ça prend trop de temps de regarder :(

n°977570
francescu
youpee !!
Posté le 10-02-2005 à 13:00:07  profilanswer
 

oups, j'ai tout recommencé version 'homme' :
 

Code :
  1. <?
  2. include("./includes/connect.php3" );
  3.   header("Cache-Control: no-cache, must-revalidate" );          // HTTP/1.1  
  4.   header("Pragma: no-cache" );                                  // HTTP/1.0  
  5. //--------------------- recuperation des enregistrements bateaux locations--  
  6. //---------------------------------------------------------------------  
  7. //Mise à jour de action pour modification-----------------------------------  
  8.     if (isset($id))
  9.         $action = "modifier";
  10.        
  11. //--------------------------------------------------------------------------     
  12. //Affichage des infos location----------------------------------------------  
  13. if (($action == "modifier" ) ||($action=="update" )) 
  14.           {
  15.         $query3= "select * from location where num_location = '$id'";
  16.           $result3 = mysql_query($query3);
  17.           $ligne1 = mysql_fetch_array($result3);
  18.         $loc = mysql_fetch_object($result3);
  19.               }
  20.            
  21. ?>
  22. <HTML>
  23. <HEAD>
  24. <title>aaaa</title>
  25. </head>
  26. <body leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">
  27. <link rel="stylesheet" type="text/css" href="./includes/classe.css">
  28. <table width="894" height"672" border="0" cellspacing="0" cellpadding="0" >
  29.   <tr>
  30.     <td width="6" height="255">&nbsp;</td>
  31.     <td width="8" valign="top">&nbsp;</td>
  32.     <td width="880" height="255" colspan="3" >
  33.     <form action="detail_location.php3" name="form" method="post">
  34.         <table width="859" height="88%" border="0" align="left" cellpadding="1" cellspacing="1">
  35.           <tr> 
  36.          <td width="131" >Nom location
  37.        
  38. <input type="hidden" name="action" value="<?
  39.        if($action=="modifier" ) echo"update";
  40.          elseif($action=="nouveau" ) echo"nouveau";    ?>">
  41.       </div> </td>
  42.        
  43.          <td colspan="3">
  44.    <input type="text" name="nom_location" size="35" value="<? if($action == "modifier" )  print"$ligne1[nom_location]"; ?>"
  45.               maxlength="35" >
  46.          </font></td>
  47.          <td width="91" height="26" >Photo n&deg;1</td>
  48.          <td width="304" ><input name="img_vue_grand" type="file" size="22"></td>
  49.           </tr>
  50.         <tr> 
  51.         <td width="131" > <div align="left">&nbsp;Type bateau </td>
  52.         <td colspan="3" ><select name="type_bateau">
  53.           <option value="1" selected <? if(($action=="modifier" )||($action=="update" )) { if ($ligne1[type_bateau] == "Semi_rigide" ) echo" selected";}?>>Semi_rigide</option>
  54.           <option value="2" <? if (($action=="modifier" )||($action=="update" )) { if ($ligne1[type_bateau] == "Coque_Open" ) echo" selected";} ?>>Coque_Open</option>
  55.           <option value="3" <? if (($action=="modifier" )||($action=="update" )) { if ($ligne1[type_bateau] == "Habitable" ) echo" selected";} ?> Habitable</option>
  56.         </select></td>
  57.         <td> Photo n&deg;2</td>
  58.           <td ><input name="img_vue_grand" type="file" size="22"></td>
  59.         </tr>
  60.           <tr> 
  61.             <td>Puissance</td>
  62.             <td colspan="3"
  63.               <input type="text" name="cv" size="12" value="<? if($action == "modifier" ) print"$ligne1[cv]";?>" maxlength="2">
  64.             <td>
  65.             <td > Photo n&deg;3</td>
  66.             <td><input name="img_vue_grand" type="file" size="22"></td>
  67.           </tr>
  68.           <tr> 
  69.             <td>
  70.             Longueur</td>
  71.             <td>
  72.               <input type="text" name="longueur" size="12" value="<? if($action == "modifier" ) print"$ligne1[longueur]";?>" maxlength="12">
  73.             </td>
  74.             <td> 
  75.            </td>
  76.           </tr>
  77.           <tr> 
  78.             <td> 
  79.             Nombre de &nbsp;personnes</td>
  80.             <td colspan="3" ><
  81. <input type="text" name="nb_personne" size="12" value="<? if($action == "modifier" ) print"$ligne1[nb_personne]";?>" maxlength="12">
  82.             </font></td>
  83.             <td rowspan="4"> Descriptions    </td>
  84.             <td rowspan="4" >
  85.     <textarea name="descriptions" cols="40" rows="6" wrap="VIRTUAL" ><? if($action == "modifier" ) echo"$ligne1[descriptions]";?>
  86.               </textarea></td>
  87.           </tr>
  88.           <tr>
  89.             <td>&nbsp;Caution</td>
  90.             <td colspan="3" >
  91. <input type="text" name="caution" size="12"value="<? if($action == "modifier" ) print"$ligne1[caution]";?>" maxlength="12"></td>
  92.           </tr>
  93.           <tr> 
  94.             <td width="131" height="24"> &nbsp;Tarif journee</td>
  95.             <td width="79" >
  96.    <input name="tarif_journee" type="text" size="12" maxlength="12" value="<? if($action == "modifier" ) print"$ligne1[tarif_journee]";?>">
  97.             <td>
  98.        <td width="138" >&nbsp;Tarif 3 jours </font></div></td>
  99.         <td width="97">
  100.         <input name="tarif_3" type="text" size="12" maxlength="12" value="<? if($action == "modifier" ) print"$ligne1[tarif_3]";?>"></td>
  101.           </tr>
  102.           <tr> 
  103.         <td>&nbsp;Tarif 7 jours </font></td>
  104.         <td>
  105. <input type="text" name="tarif_7" size="12" value="<? if($action == "modifier" ) print"$ligne1[tarif_7]";?>" maxlength="12"></td>
  106.         <td>Tarif 15 jours</td>
  107.         <td>
  108.         <input name="tarif_15" type="text" size="12" maxlength="12" value="<? if($action == "modifier" ) print"$ligne1[tarif_15]";?>"></td>
  109.           </tr>
  110.           <tr > 
  111.             <td height="26" ></td>
  112.             <td colspan="3" >
  113.          <input type="submit" name="envoyer" value="Envoyer">   <td>
  114.             <td colspan="2" >&nbsp;
  115.             </td>
  116.           </tr>
  117.         <input type="hidden" name="id" value="<? echo"$id";?>">
  118.         </table>
  119.     </form> </td>   
  120.   </tr>
  121. </table>   
  122. </BODY></HTML>


 
 
 
la deuxieme :
 
 

Code :
  1. <? 
  2.   header("Cache-Control: no-cache, must-revalidate" );          // HTTP/1.1  
  3.   header("Pragma: no-cache" );                                  // HTTP/1.0  
  4. include("./includes/connect.php3" );
  5. //--------------------- recuperation des enregistrments bateaux locations---------  
  6. $query_aff="select * from location where num_location='$id'";
  7. $result_aff=mysql_query($query_aff);
  8. $obj_aff=mysql_fetch_object($result_aff);
  9. //---------------------------------------------------------------------  
  10. //-------------------------------------------------------------------------------  
  11. //enregistrer un mouveau bateau de location---------------------------------------------------         
  12.     if($action == "nouveau" )
  13.     {
  14.     $query_nv= "insert into location (nom_location ,type_bateau ,cv ,longueur ,descriptions ,nb_personne ,caution ,tarif_journee, tarif_3,  tarif_7, tarif_15) values('$nom_location','$type_bateau','$cv','$longueur','$descriptions','$nb_personne','$caution','$tarif_journee','$tarif_3','$tarif_7', '$tarif_15')";
  15.     $result_nv = mysql_query($query_nv);
  16. if(!$result_nv) echo "Erreur d'enregistrement";
  17.     }
  18.    
  19. //--------------------------------------------------------------------------  
  20. //--------------------------------------------------------------------------  
  21. //Mise à jour d'une location---------------------------------------------------         
  22.     if($action == "update" )
  23.     {
  24.     $query_up="update location set nom_location='$nom_location', type_bateau='$type_bateau', cv='$cv', longueur='$longueur', descriptions='$descriptions', nb_personne='$nb_personne', caution='$caution' , tarif_journee='$tarif_journee', tarif_3='$tarif_3', tarif_7='$tarif_7', tarif_15='$tarif_15' where num_location='$id';";
  25.     $result_up = mysql_query($query_up);
  26.    
  27.    if(!$result_up) echo "Erreur d'enregistrement";
  28.     }
  29. //---------------------------------------------------------------------------  
  30. //---------------------------------------------------------------------------  
  31. ?>
  32. <HTML>
  33. <HEAD>
  34. <title>Administration  </title>
  35. <body leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">
  36. <table width="913" height="54%"  border="0" align="left" cellpadding="0" cellspacing="0">
  37.    
  38.       <tr>
  39.         <td height="224" colspan="2" valign="top">
  40.         <table width="100%" border="1" cellspacing="0" cellpadding="0" bordercolor="#CCCCCC">
  41.           <tr bgcolor="#CCCCCC">&nbsp;  </td>
  42.             <td colspan="2" ><a href="admin.php3" target="_parent"> Accueil administration</a> </td>
  43.             <td width="46%">
  44. <a href="saisie_location.php3?action=nvlocation" >
  45. Ajouter une location </a>
  46.             </div> </td>
  47.           </tr>
  48.           <tr bgcolor="#F5F5F5">
  49.             <td colspan="2">Nom location</td>
  50.             <td colspan="2">
  51. <? echo"$obj_aff->nom_location";></td>
  52.           </tr>
  53.           <tr bgcolor="#E6E8E8">
  54.             <td colspan="2"><Type bateau </td>
  55.             <td colspan="2">  <?  echo"$obj_aff->type_bateau"; ?>
  56.             </td>
  57.           </tr>
  58.           <tr bgcolor="#F5F5F5">
  59.             <td colspan="2" valign="top"></td>
  60.             <td height="20" colspan="2" >
  61.                 <?  echo"$obj_aff->cv";?>
  62.         <td>
  63.           </tr>
  64.           <tr >
  65.             <td colspan="2" bgcolor="#E6E8E8>Longueur</td>
  66.             <td colspan="2"><div align="center">
  67.                 <?  echo"$obj_aff->longueur"; ?>
  68.             </td>
  69.           </tr>
  70.           <tr bgcolor="#F5F5F5">
  71.             <td height="49" colspan="2">Descriptions</td>
  72.             <td colspan="2">
  73.                 <? $descriptions=nl2br($obj_aff->descriptions); ?>
  74.                 <?  echo"$obj_aff->descriptions"; ?>
  75.             </td>
  76.           </tr>
  77.           <tr>
  78.             <td colspan="2">Nbre personne </td>
  79.             <td colspan="2"> <? echo"$obj_aff->nb_personne"; ?></td>
  80.           </tr>
  81.           <tr bgcolor="#F5F5F5">
  82.             <td colspan="2">Caution</td>
  83.             <td colspan="2>     <?  echo"$obj_aff->caution";?>
  84.            </td>
  85.           </tr>
  86.           <tr bgcolor="#E6E8E8">
  87.             <td colspan="2" >Tarif journee</td>
  88.             <td height="20" colspan="2">
  89. <? echo"$obj_aff->tarif_journee"; ?><td>
  90.           </tr>
  91.           <tr bgcolor="#F5F5F5">
  92.             <td colspan="2"> Tarif 3 jours
  93. <td height="22" colspan="2">               
  94. <? echo"$obj_aff->tarif_3"; ?>
  95.               td>
  96.           </tr>
  97.           <tr bgcolor="#E6E8E8">
  98.             <td colspan="2">Tarif 7 jours <td>
  99.             <td height="20" colspan="2" >
  100.                 <?  echo"$obj_aff->tarif_7"; ?>
  101.             </td>
  102.           </tr>
  103.           <tr>
  104.             <td colspan="2">Tarif 15 jours </td>
  105.         <td height="20" colspan="2" >
  106. <? echo"$obj_aff->tarif_15"; ?> </td>
  107.           </tr>
  108.         </table></td>
  109.       </tr>
  110.     </table>


 
voila... c'est sur que c'est plus clair la...
Une bonne journee !!
merci

n°977585
FlorentG
Unité de Masse
Posté le 10-02-2005 à 13:32:47  profilanswer
 

Bof :/... Le problème c'est qu'il faudrait se plonger dans tes scripts, ce qui prend pas mal de temps :(

n°977598
francescu
youpee !!
Posté le 10-02-2005 à 13:40:42  profilanswer
 

FlorentG a écrit :

Bof :/... Le problème c'est qu'il faudrait se plonger dans tes scripts, ce qui prend pas mal de temps :(


 
tu pense qu'il faudrait que je fasse comment?
le truc c'est que je me casse les dents dessus depuis trois jours ety a pas, je vois pas...  
c'est pas grave... je ferais appel a un ami ou alors le 50/50  :)  
 
hihi  :bounce:  
 

n°977600
FlorentG
Unité de Masse
Posté le 10-02-2005 à 13:43:09  profilanswer
 

Déjà allège le code HTML, vire tous les tableaux et refait tout en XHTML+CSS structuré et sémantique. Ca sera déjà 50x plus clair. Ou alors vire-nous le code HTML qui ne sert à rien, garde juste les bouts de scripts susceptibles de planter...

n°977602
francescu
youpee !!
Posté le 10-02-2005 à 13:44:30  profilanswer
 

okay... merci.. je fais ca e suite... !!

n°977612
francescu
youpee !!
Posté le 10-02-2005 à 13:55:15  profilanswer
 

premiere page.. hihi on va y arrivé, merci Florent :pt1cable:  

Code :
  1. <?
  2. include("./includes/connect.php3" );
  3.   header("Cache-Control: no-cache, must-revalidate" );          // HTTP/1.1
  4.   header("Pragma: no-cache" );                                  // HTTP/1.0
  5. //--------------------- recuperation des enregistrements bateaux locations--
  6. //---------------------------------------------------------------------
  7. //Mise à jour de action pour modification-----------------------------------
  8. if (isset($id))
  9.  $action = "modifier";
  10. //--------------------------------------------------------------------------  
  11. //Affichage des infos location----------------------------------------------
  12. if (($action == "modifier" ) ||($action=="update" ))
  13.    {
  14.  $query3= "select * from location where num_location = '$id'";
  15.    $result3 = mysql_query($query3);
  16.    $ligne1 = mysql_fetch_array($result3);
  17.  $loc = mysql_fetch_object($result3);
  18.     }
  19. ?>
  20. <form action="detail_location.php3" name="form" method="post">
  21.   <input type="hidden" name="action" value="<?
  22.    if($action=="modifier" ) echo"update";
  23.      elseif($action=="nouveau" ) echo"nouveau"; ?>">
  24.      
  25. ....

sur la deuxieme page.... por l'enregistrement et la modification...
 
 
 
[cpp]
<?  
  header("Cache-Control: no-cache, must-revalidate" );          // HTTP/1.1
  header("Pragma: no-cache" );                                  // HTTP/1.0
include("./includes/connect.php3" );
//--------------------- recuperation des enregistrments bateaux locations---------
$query_aff="select * from location where num_location='$id'";
$result_aff=mysql_query($query_aff);
$obj_aff=mysql_fetch_object($result_aff);
//---------------------------------------------------------------------
//-------------------------------------------------------------------------------
//enregistrer un mouveau bateau de location---------------------------------------------------  
 if($action == "nouveau" )
 {
 $query_nv= "insert into location (nom_location ,type_bateau ,cv ,longueur ,descriptions ,nb_personne ,caution ,tarif_journee, tarif_3,  tarif_7, tarif_15) values('$nom_location','$type_bateau','$cv','$longueur','$descriptions','$nb_personne','$caution','$tarif_journee','$tarif_3','$tarif_7', '$tarif_15')";
 $result_nv = mysql_query($query_nv);
if(!$result_nv) echo "Erreur d'enregistrement";
 }
 
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
//Mise à jour d'une location---------------------------------------------------  
 if($action == "update" )
 {
 $query_up="update location set nom_location='$nom_location', type_bateau='$type_bateau', cv='$cv', longueur='$longueur', descriptions='$descriptions', nb_personne='$nb_personne', caution='$caution' , tarif_journee='$tarif_journee', tarif_3='$tarif_3', tarif_7='$tarif_7', tarif_15='$tarif_15' where num_location='$id';";
 $result_up = mysql_query($query_up);
 
   if(!$result_up) echo "Erreur d'enregistrement";
 }
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
?>
 
 
<td> <? echo"$obj_aff->nom_location"; ?> </td>   //  pour l'affichage

n°977614
francescu
youpee !!
Posté le 10-02-2005 à 13:56:34  profilanswer
 

mais rien ne s'affiche quand j'enregistre un nouvel "objet"... La base se rempli mais l'affichage deconne....

n°977616
FlorentG
Unité de Masse
Posté le 10-02-2005 à 13:58:40  profilanswer
 

Sûrement une erreur lors de l'enregistrement, genre les quote qui sont pas escapés.
 
Sinon c'est dur de piger, parce que t'as register_globals sur off, ce qui est super dangereux. N'utilise jamais les nom de variable directement, genre au lieu de :

$action


Utilise :

$_POST['action']


Message édité par FlorentG le 10-02-2005 à 13:59:01
mood
Publicité
Posté le 10-02-2005 à 13:58:40  profilanswer
 

n°977625
francescu
youpee !!
Posté le 10-02-2005 à 14:04:17  profilanswer
 

"register_globals sur off"   non non d'apres mon phpinfo() , il est sur "on"....
genre ; $action = "modifier";  
serait $_POST['action']="modifier" ?
c'est bien ca?

n°977628
Dj YeLL
$question = $to_be || !$to_be;
Posté le 10-02-2005 à 14:05:34  profilanswer
 

Non,, c'est le contraire
 
$action != $_POST['action']
 
++


---------------
Gamertag: CoteBlack YeLL
n°977633
Profil sup​primé
Posté le 10-02-2005 à 14:09:15  answer
 

comme le dis FlorentG, tu dois toujours vérifier la provenance de tes variable
desactive register_global dans ton php.ini, recupere tes variables par $_GET pour une variable provenant de l'url et par $_POST pour tes variables de formulaire
 
aussi :
- faire echo "$tavariable" c'est assez laid : enleve les "
- tu as oublié une fermeture de balise <option> dans ta page 1
- fait des echos de ta requete dans tes if qui semblent ne pas fonctionner pour voir si elle est valide
- si tu as plusieurs action possible suivant la valeur d'une variable($action dans ton cas) utilise switch() plutot que if(), c'est plus lisible

n°977648
francescu
youpee !!
Posté le 10-02-2005 à 14:18:03  profilanswer
 

oki...
alors je fais afficher mes variables, et suivant mes actions elles sont bien differentes...ben oui puisqu'en modification ca marche, l'enregistrement aussi. La bonne question serait plutot : le passage de l'id dans la 2eme page ne se fait pas qd ma variable action == nouveau, pourquoi donc? et là effectivement, je n'ai pas d'identifiant qui apparait quand je fais mon echo...
Merci bcp pour votre aide !!!
 
 
Je connais pas switch c'est comme un case?  
c'est que c'est mon premier site,

n°977662
Profil sup​primé
Posté le 10-02-2005 à 14:24:40  answer
 

francescu a écrit :

oki...
alors je fais afficher mes variables, et suivant mes actions elles sont bien differentes...ben oui puisqu'en modification ca marche, l'enregistrement aussi. La bonne question serait plutot : le passage de l'id dans la 2eme page ne se fait pas qd ma variable action == nouveau, pourquoi donc? et là effectivement, je n'ai pas d'identifiant qui apparait quand je fais mon echo...
Merci bcp pour votre aide !!!
 
 
Je connais pas switch c'est comme un case?  
c'est que c'est mon premier site,


Code :
  1. switch($tavariable) {
  2.   case 'valeur1':
  3.     break;
  4.   case 'valeur2':
  5.     break;
  6.   default:
  7.      echo 'valeur incorecte';
  8.     break;
  9. }

n°977671
francescu
youpee !!
Posté le 10-02-2005 à 14:34:49  profilanswer
 

j'yarrive pas...
a la limite je ferais un switch quand j'aurai compris pourquoi rien ne s'affiche en mode enregistrement...
merci beaucoup
;)

n°977817
francescu
youpee !!
Posté le 10-02-2005 à 16:43:27  profilanswer
 

a l'aide....
je craque, je n'y arrive pas !!

n°977924
francescu
youpee !!
Posté le 10-02-2005 à 19:06:49  profilanswer
 

euh... up ?!?

n°977936
francescu
youpee !!
Posté le 10-02-2005 à 19:29:48  profilanswer
 

HELP please !!!  :bounce:

n°978030
francescu
youpee !!
Posté le 10-02-2005 à 21:42:54  profilanswer
 

up !!

n°978072
KangOl
Profil : pointeur
Posté le 10-02-2005 à 22:31:54  profilanswer
 

down !


---------------
Nos estans firs di nosse pitite patreye...
n°978073
KangOl
Profil : pointeur
Posté le 10-02-2005 à 22:32:09  profilanswer
 

a bha ca marche pas [:spamafote]


---------------
Nos estans firs di nosse pitite patreye...
n°978093
francescu
youpee !!
Posté le 10-02-2005 à 22:53:22  profilanswer
 

:hello:

mood
Publicité
Posté le   profilanswer
 


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  PHP

  passage d'info d'une page a une autre

 

Sujets relatifs
fsockopen et passage de variable postSaut de de page avec '\f' na marche pas ?
[c#] [.NET] pb sauvegarde pageInséré une vidéo dans une page web
Menu déroulant au passage de la sourisComment afficher une page html depuis une application java [Réglé]
Page web mystère (pour moi !)[SQL Light] Info ??! please
[QUESTION] Executer un .bat dans une page php ?Récupéré un pdf derrière une page accéssible via formulaire html
Plus de sujets relatifs à : passage d'info d'une page a une autre


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR