Se connecter avec
S'enregistrer | Connectez-vous

Récup d'un texte et non de la valeur

Dernière réponse : dans Programmation

Bonjour,
par ce programme j'aimerais récupérer le texte VTIDTY01 pour l'alimenter dans VTIDTY1A
le pb c'est que la valeur que je récupère correspond à l'identifiant associé au texte et non le texte
Merci

<?
session_start ();
?>

  1. <html>
  2. <title>Document sans nom</title>
  3. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  4. <SCRIPT SRC="code_externe.js"></SCRIPT>
  5. <form action=vente_gestion_menu_saisie_creation.php name=formulaire method=POST target=corps>
  6.  
  7. <style type="text/css">
  8. <!--
  9. body {
  10. background-image: url(images/fond3.gif);
  11. margin-left: 0px;
  12. margin-top: 0px;
  13. margin-right: 0px;
  14. margin-bottom: 0px;
  15. }
  16. .Style1 {
  17. font-family: Courier, Courier, sans-serif;
  18. font-size: 13px;
  19. color: #003366;
  20. }
  21. .Style2 {
  22. font-family: Courier, Courier, sans-serif;
  23. font-size: 13px;
  24. color: #003366;
  25. }
  26. -->
  27. </style>
  28. </head>
  29. <body>
  30.  
  31.  
  32.  
  33. <?
  34. $_SESSION["banner"]="Création d'une Vente";
  35. include ("main_gestion_fonction_javascript.php");
  36. include ("main_gestion_fonction_php.php");
  37.  
  38. $now = date("d-m-Y");
  39. $nowymd = date("Y-m-d");
  40.  
  41.  
  42. $link = mysql_pconnect("localhost","thalie","thalie");
  43. if (!$link) {
  44. die('Connection MYSQL impossible : ' . mysql_error());
  45. }
  46. mysql_select_db("institut");
  47.  
  48. $VTIDCL=$_POST['VTIDCL'];
  49. $VTIDVE=$_POST['VTIDVE'];
  50. $result1 = mysql_query("SELECT * FROM vendeuses where `VEIDVE`='$VTIDVE'
  51. order by `VELINM`, `VELIPE`");
  52. $result2 = mysql_query("SELECT * FROM clients where `CLIDCL`='$VTIDCL'
  53. order by `CLLINM`, `CLLIPE`");
  54.  
  55.  
  56.  
  57. $result4 = mysql_query("SELECT * FROM familles
  58. order by `FALIFA`");
  59.  
  60.  
  61. $requete="SELECT * FROM types where `TYCDVT`='O' order by `TYLITY`";
  62. $nomtabjs="tableautype";
  63. $TADAAR=date("Y-m-d");
  64. $nb_enregtype=mysql_to_js($requete, $nomtabjs);
  65. $requete="SELECT * FROM tarification where `TADAAR`<='$TADAAR' and
  66. `TADADE`>='$TADAAR'
  67. order by `TAPTTC`";
  68. $nomtabjs="tableautarif";
  69.  
  70. $nb_enregtarif=mysql_to_js($requete, $nomtabjs);
  71. ?>
  72. <script language="Javascript">
  73. parent.banner.location='main_banner.php'
  74.  
  75. function runSubmit (form, button)
  76. {
  77.  
  78. //***********************Saisie d'une vente***************************
  79. if (form.VTIDTA01.value==0)
  80. {
  81. alert("Aucune vente n'est saisie ");
  82. {variable.focus(); return;}
  83. }
  84.  
  85.  
  86. // Validation du formulaire
  87. form.submit();
  88.  
  89. }
  90.  
  91. </script>
  92. <div
  93. style="position: absolute; left: 25px; top: 125px; z-index: 5; text-align: left;"><br>
  94. <table width="100%" height="" align="left">
  95. <tr> <td width="1%"><p class="Style2">01</p></td>
  96. <td width="25%"><input maxlength="32" name=VTIDFA1A value=" "></td>
  97. <td width="25%"><input maxlength="32" name=VTIDTY1A ></td>
  98. <td width="20%"><input maxlength="8" name=VTPTTC1A value=" "></td>
  99. <td width="18%" ><input maxlength="8" name=VTQTVT1A value=" "></td>
  100. <td width="1%" ><input maxlength="8" name=VTIDTA1A value=" "></td>
  101. </tr>
  102. <tr> <td><p class="Style2"> </p></td>
  103. <td><select class="Style2" name=VTIDFA01 onchange="selectfamille(this.form,this.options.selectedIndex,form.VTIDFA01.value,document.formulaire.VTIDTY01,document.formulaire.VTPTTC01,1)">
  104. <option value="0">Choisir une Famille-------------</option>;
  105. <? $i = 0;
  106. while ($i < mysql_num_rows($result4)) {
  107. echo "<option value=".mysql_result($result4,$i,'FAIDFA').">".mysql_result($result4,$i,'FALIFA')."</option>";
  108. $i++;
  109. }
  110. mysql_close($link);
  111.  
  112. ?></select></td>
  113. <td><select class="Style2" name=VTIDTY01 onchange="selecttype(this.form,this.options.selectedIndex,document.formulaire.VTIDTY01[this.options.selectedIndex].value,document.formulaire.VTPTTC01,1)">
  114. <option value=" " selected>Selection------------------------</option>
  115. </select></td>
  116. <td><select class="Style2" name=VTPTTC01 onchange="Recup01(this.form,formulaire.VTPTTC01[this.options.selectedIndex].text,this.options.selectedIndex)" >
  117. <option value=" " selected>Selection-------</option>
  118. </select></td>
  119.  
  120. <td><select class="Style2" name=VTQTVT01 value=1 onchange="CalculPrixTTC(this.form)" >
  121. <option value=1>1</option>
  122. <option value=2>2</option>
  123. <option value=3>3</option>
  124. <option value=4>4</option>
  125. <option value=5>5</option>
  126. <option value=6>6</option>
  127. <option value=7>7</option>
  128. <option value=8>8</option>
  129. <option value=9>9</option>
  130. <option value=10>10</option>
  131. </select></td>
  132. <td><input maxlength="8" type=hidden name=VTIDTA01 ></td>
  133. </tr>
  134. </table>
  135.  
  136. </div>
  137. </body>
  138. </html>
  139. <script language="Javascript">
  140. parent.banner.location='main_banner.php';
  141.  
  142. // Chargement du groupe de selection des types
  143. var nbenregtype='<? echo $nb_enregtype+1;?>';
  144. var groups1=nbenregtype;
  145. var group1=new Array(groups1);
  146. for (i=0; i<groups1; i++)
  147. {group1[i]=new Array();}
  148. group1[0][0]=new Option("Selection------------------------"," ");
  149.  
  150. // Chargement du groupe de selection des tarifications
  151. var nbenregtarif='<? echo $nb_enregtarif+1;?>';
  152. i=0
  153. a=0
  154. while (tableautype["TYIDTY"][i] != null)
  155. {b=parseInt(tableautype["TYIDTY"][i],10);
  156. if (a < b)
  157. {tailletab=b;
  158. a=b;}
  159. i++}
  160. var groups2=tailletab+1;
  161. var group2=new Array(groups2);
  162. for (i=0; i<groups2; i++)
  163. {group2[i]=new Array();}
  164. group2[0][0]=new Option("Selection-------"," ");
  165.  
  166. function selectfamille(form,x,variable,variable1,variable2,numvente)
  167. {
  168. form.VTQTVT01.value=1;
  169. form.VTIDTA01.value=0;
  170. form.VTPTTC.value="0.00";
  171. //IDFA1 identifiant famille
  172. IDFA1=variable
  173. //temp3 formulaire type
  174. temp3=variable1
  175. //temp4 formulaire tarif
  176. temp4=variable2
  177.  
  178. //nombre d'enregistrement de la base type
  179. enreg='<? echo $nb_enregtype;?>';
  180.  
  181. //mise en place du gabarit type
  182. group1[0][0]=new Option("Selection------------------------"," ");
  183.  
  184. a=1
  185. // Pour tous les enregistrements de la base type
  186. // Si l'identifiant trouvé dans la base type correspont à l'identifiant de la famille selectionné
  187. // alors creation du tableau d'options type
  188. for (i=0;i<enreg;i++)
  189. {
  190. if(tableautype["TYIDFA"][i]==IDFA1)
  191. {
  192. lity1=tableautype["TYLITY"][i]
  193. idty1=tableautype["TYIDTY"][i]
  194. group1[IDFA1][0]=new Option("Selection------------------------"," ");
  195. group1[IDFA1][a]=new Option(lity1,idty1);
  196. a++
  197. }
  198. }
  199.  
  200. // a prend la nouvelle valeur du nombre de type dans le tableau d'option
  201. a=group1[IDFA1].length
  202.  
  203. // b prend l'ancienne valeur du nombre de type dans le tableau d'option
  204. b=temp3.options.length
  205.  
  206. // Si il n'y a pas de type correspondant à la famille
  207. if (a==0)
  208. {
  209.  
  210. // Pour tous les anciens enregistrements de type dans l'affichage du tableau d'option
  211. // remise à 0
  212. for (m=temp3.options.length-1;m>0;m--)
  213. temp3.options[m]=null
  214.  
  215. // Pour tous les anciens enregistrements de tarif dans l'affichage du tableau d'option
  216. // remise à 0
  217. for (m=temp4.options.length-1;m>0;m--)
  218. temp4.options[m]=null
  219.  
  220. // Le champs type prends la valeur Selection------------
  221. temp3.options[0]=new Option(group1[0][0].text,group1[0][0].value)
  222.  
  223. // Le champs tarif prends la valeur Selection------------
  224. temp4.options[0]=new Option(group2[0][0].text,group2[0][0].value)
  225.  
  226. }
  227.  
  228. // Pour tous les anciens enregistrements de type dans l'affichage du tableau d'option
  229. // remise à 0
  230. for (m=temp3.options.length-1;m>0;m--)
  231. temp3.options[m]=null
  232.  
  233. // Pour tous les anciens enregistrements de tarif dans l'affichage du tableau d'option
  234. // remise à 0
  235. for (m=temp4.options.length-1;m>0;m--)
  236. temp4.options[m]=null
  237.  
  238. // Le champs type prends la valeur Selection------------
  239. temp3.options[0]=new Option(group1[0][0].text,group1[0][0].value)
  240. // Le champs tarif prends la valeur Selection------------
  241. temp4.options[0]=new Option(group2[0][0].text,group2[0][0].value)
  242.  
  243. // Pour tous les types existant alors affichage de tous les types
  244. for (i=0;i<=a;i++)
  245. {
  246. temp3.options[i]=new Option(group1[IDFA1][i].text,group1[IDFA1][i].value)
  247. }
  248. temp3.options[0].selected=true
  249.  
  250. }
  251.  
  252.  
  253. function selecttype(form,z,variable1,variable2,numvente)
  254. {
  255. form.VTQTVT01.value=1;
  256. form.VTPTTC.value="0.00";
  257. form.VTIDTA01.value=0;
  258. //taidty1 identifiant type
  259. taidty1=variable1
  260.  
  261. //temp4 formulaire tarif
  262. temp4=variable2
  263. // enreg nombre d'enregistrement dans la table de tarification
  264. enreg='<? echo $nb_enregtarif;?>';
  265. // Initialisation du gabarit pour les tarifs
  266. group2[0][0]=new Option("Selection-------"," ");
  267.  
  268. // Pour tous les enregistrement de la base tarif
  269. // Si l'identifiant trouvé dans la base tarif correspont à l'identifiant du type selectionné
  270. // alors creation du tableau d'options tarif
  271. a=1
  272. if(z!=0)
  273. {
  274. for (i=0;i<enreg;i++)
  275. {
  276. if(tableautarif["TAIDTY"][i]==taidty1)
  277. {
  278. lity=tableautarif["TAPTTC"][i]
  279. idty=tableautarif["TAIDTA"][i]
  280. group2[taidty1][0]=new Option("Selection-------"," ");
  281. group2[taidty1][a]=new Option(lity,idty);
  282. a++
  283. }
  284.  
  285. }
  286.  
  287. // a prend la valeur du nombre de tarif dans le tableau d'option
  288. a=group2[taidty1].length
  289. }
  290. // a prend l'ancienne valeur du nombre de tarif dans le tableau d'option
  291. b=temp4.options.length
  292.  
  293. // Si il n'y a pas de tarif correspondant au type
  294. if (a==0)
  295. {
  296.  
  297.  
  298. for (m=temp3.options.length-1;m>0;m--)
  299. temp4.options[m]=null
  300.  
  301. temp4.options[0]=new Option(group2[0][0].text,group2[0][0].value)
  302.  
  303. }
  304. for (m=temp4.options.length-1;m>0;m--)
  305. temp4.options[m]=null
  306.  
  307.  
  308.  
  309. temp4.options[0]=new Option(group2[0][0].text,group2[0][0].value)
  310. if (z==0 && numvente==1)
  311. {
  312. form.VTIDTA01.value=0
  313. form.VTQTVT01.value=1
  314. }
  315.  
  316.  
  317. if(z!=0)
  318. {
  319. for (i=0;i<=a;i++)
  320. {
  321. temp4.options[i]=new Option(group2[taidty1][i].text,group2[taidty1][i].value)
  322. }
  323. }
  324. temp4.options[0].selected=true
  325.  
  326. }
  327.  
  328. function Recup01(form,b,c)
  329. {
  330. form.VTIDTA01.value=form.VTPTTC01.value;
  331. prix01=b;
  332. prix01=parseFloat(prix01);
  333. qte1=parseInt(form.VTQTVT01.value,10);
  334. valeurtotal=prix01*qte1;
  335. valeurtotal= Math.round (valeurtotal*100)/100;
  336. //Ajout des 0 apres la virgule
  337. valeurtotal=valeurtotal.toString();
  338. montant_array=valeurtotal.split(".");
  339. if (!montant_array[1])
  340. {valeurtotal=valeurtotal+".00";}
  341. else if (montant_array[1].length == 1)
  342. {valeurtotal=valeurtotal+"0";}
  343. form.VTPTTC.value=valeurtotal;
  344. }
  345.  
  346. function CalculPrixTTC(form)
  347. {
  348. // form.VTIDFA1A.value=fa;
  349. // C'EST ICI LE PB
  350. form.VTIDTY1A.value=form.VTIDTY01.value;
  351. // form.VTPTTC1A.value=tc;
  352. // form.VTQTVT1A.value=vt;
  353. // form.VTIDTA1A.value=ta;
  354. prix01=parseFloat(prix01);
  355. qte1=parseInt(form.VTQTVT01.value,10);
  356. valeurtotal=prix01*qte1;
  357. valeurtotal= Math.round (valeurtotal*100)/100;
  358. //Ajout des 0 apres la virgule
  359. valeurtotal=valeurtotal.toString();
  360. montant_array=valeurtotal.split(".");
  361. if (!montant_array[1])
  362. {valeurtotal=valeurtotal+".00";}
  363. else if (montant_array[1].length == 1)
  364. {valeurtotal=valeurtotal+"0";}
  365. form.VTPTTC.value=valeurtotal;
  366. }
  367. </script>

Autres pages sur : recup texte valeur

Lassé par la pub ? Créez un compte
Expert Programmation

Bienvenue sur ce forum, Thalie.
Va faire un ptit tour du côté des trois premiers sujets repérables par ce logo : .
Tu y apprendras par exemple qu'il faut mettre ton code entre les balides [ CODE ] et [/ CODE ].
Lassé par la pub ? Créez un compte