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 ();
?>
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 ();
?>
<html> <title>Document sans nom</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <SCRIPT SRC="code_externe.js"></SCRIPT> <form action=vente_gestion_menu_saisie_creation.php name=formulaire method=POST target=corps> <style type="text/css"> <!-- body { background-image: url(images/fond3.gif); margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; } .Style1 { font-family: Courier, Courier, sans-serif; font-size: 13px; color: #003366; } .Style2 { font-family: Courier, Courier, sans-serif; font-size: 13px; color: #003366; } --> </style> </head> <body> <? $_SESSION["banner"]="Création d'une Vente"; include ("main_gestion_fonction_javascript.php"); include ("main_gestion_fonction_php.php"); $now = date("d-m-Y"); $nowymd = date("Y-m-d"); $link = mysql_pconnect("localhost","thalie","thalie"); if (!$link) { die('Connection MYSQL impossible : ' . mysql_error()); } mysql_select_db("institut"); $VTIDCL=$_POST['VTIDCL']; $VTIDVE=$_POST['VTIDVE']; $result1 = mysql_query("SELECT * FROM vendeuses where `VEIDVE`='$VTIDVE' order by `VELINM`, `VELIPE`"); $result2 = mysql_query("SELECT * FROM clients where `CLIDCL`='$VTIDCL' order by `CLLINM`, `CLLIPE`"); $result4 = mysql_query("SELECT * FROM familles order by `FALIFA`"); $requete="SELECT * FROM types where `TYCDVT`='O' order by `TYLITY`"; $nomtabjs="tableautype"; $TADAAR=date("Y-m-d"); $nb_enregtype=mysql_to_js($requete, $nomtabjs); $requete="SELECT * FROM tarification where `TADAAR`<='$TADAAR' and `TADADE`>='$TADAAR' order by `TAPTTC`"; $nomtabjs="tableautarif"; $nb_enregtarif=mysql_to_js($requete, $nomtabjs); ?> <script language="Javascript"> parent.banner.location='main_banner.php' function runSubmit (form, button) { //***********************Saisie d'une vente*************************** if (form.VTIDTA01.value==0) { alert("Aucune vente n'est saisie "); {variable.focus(); return;} } // Validation du formulaire form.submit(); } </script> <div style="position: absolute; left: 25px; top: 125px; z-index: 5; text-align: left;"><br> <table width="100%" height="" align="left"> <tr> <td width="1%"><p class="Style2">01</p></td> <td width="25%"><input maxlength="32" name=VTIDFA1A value=" "></td> <td width="25%"><input maxlength="32" name=VTIDTY1A ></td> <td width="20%"><input maxlength="8" name=VTPTTC1A value=" "></td> <td width="18%" ><input maxlength="8" name=VTQTVT1A value=" "></td> <td width="1%" ><input maxlength="8" name=VTIDTA1A value=" "></td> </tr> <tr> <td><p class="Style2"> </p></td> <td><select class="Style2" name=VTIDFA01 onchange="selectfamille(this.form,this.options.selectedIndex,form.VTIDFA01.value,document.formulaire.VTIDTY01,document.formulaire.VTPTTC01,1)"> <option value="0">Choisir une Famille-------------</option>; <? $i = 0; while ($i < mysql_num_rows($result4)) { echo "<option value=".mysql_result($result4,$i,'FAIDFA').">".mysql_result($result4,$i,'FALIFA')."</option>"; $i++; } mysql_close($link); ?></select></td> <td><select class="Style2" name=VTIDTY01 onchange="selecttype(this.form,this.options.selectedIndex,document.formulaire.VTIDTY01[this.options.selectedIndex].value,document.formulaire.VTPTTC01,1)"> <option value=" " selected>Selection------------------------</option> </select></td> <td><select class="Style2" name=VTPTTC01 onchange="Recup01(this.form,formulaire.VTPTTC01[this.options.selectedIndex].text,this.options.selectedIndex)" > <option value=" " selected>Selection-------</option> </select></td> <td><select class="Style2" name=VTQTVT01 value=1 onchange="CalculPrixTTC(this.form)" > <option value=1>1</option> <option value=2>2</option> <option value=3>3</option> <option value=4>4</option> <option value=5>5</option> <option value=6>6</option> <option value=7>7</option> <option value=8>8</option> <option value=9>9</option> <option value=10>10</option> </select></td> <td><input maxlength="8" type=hidden name=VTIDTA01 ></td> </tr> </table> </div> </body> </html> <script language="Javascript"> parent.banner.location='main_banner.php'; // Chargement du groupe de selection des types var nbenregtype='<? echo $nb_enregtype+1;?>'; var groups1=nbenregtype; var group1=new Array(groups1); for (i=0; i<groups1; i++) {group1[i]=new Array();} group1[0][0]=new Option("Selection------------------------"," "); // Chargement du groupe de selection des tarifications var nbenregtarif='<? echo $nb_enregtarif+1;?>'; i=0 a=0 while (tableautype["TYIDTY"][i] != null) {b=parseInt(tableautype["TYIDTY"][i],10); if (a < b) {tailletab=b; a=b;} i++} var groups2=tailletab+1; var group2=new Array(groups2); for (i=0; i<groups2; i++) {group2[i]=new Array();} group2[0][0]=new Option("Selection-------"," "); function selectfamille(form,x,variable,variable1,variable2,numvente) { form.VTQTVT01.value=1; form.VTIDTA01.value=0; form.VTPTTC.value="0.00"; //IDFA1 identifiant famille IDFA1=variable //temp3 formulaire type temp3=variable1 //temp4 formulaire tarif temp4=variable2 //nombre d'enregistrement de la base type enreg='<? echo $nb_enregtype;?>'; //mise en place du gabarit type group1[0][0]=new Option("Selection------------------------"," "); a=1 // Pour tous les enregistrements de la base type // Si l'identifiant trouvé dans la base type correspont à l'identifiant de la famille selectionné // alors creation du tableau d'options type for (i=0;i<enreg;i++) { if(tableautype["TYIDFA"][i]==IDFA1) { lity1=tableautype["TYLITY"][i] idty1=tableautype["TYIDTY"][i] group1[IDFA1][0]=new Option("Selection------------------------"," "); group1[IDFA1][a]=new Option(lity1,idty1); a++ } } // a prend la nouvelle valeur du nombre de type dans le tableau d'option a=group1[IDFA1].length // b prend l'ancienne valeur du nombre de type dans le tableau d'option b=temp3.options.length // Si il n'y a pas de type correspondant à la famille if (a==0) { // Pour tous les anciens enregistrements de type dans l'affichage du tableau d'option // remise à 0 for (m=temp3.options.length-1;m>0;m--) temp3.options[m]=null // Pour tous les anciens enregistrements de tarif dans l'affichage du tableau d'option // remise à 0 for (m=temp4.options.length-1;m>0;m--) temp4.options[m]=null // Le champs type prends la valeur Selection------------ temp3.options[0]=new Option(group1[0][0].text,group1[0][0].value) // Le champs tarif prends la valeur Selection------------ temp4.options[0]=new Option(group2[0][0].text,group2[0][0].value) } // Pour tous les anciens enregistrements de type dans l'affichage du tableau d'option // remise à 0 for (m=temp3.options.length-1;m>0;m--) temp3.options[m]=null // Pour tous les anciens enregistrements de tarif dans l'affichage du tableau d'option // remise à 0 for (m=temp4.options.length-1;m>0;m--) temp4.options[m]=null // Le champs type prends la valeur Selection------------ temp3.options[0]=new Option(group1[0][0].text,group1[0][0].value) // Le champs tarif prends la valeur Selection------------ temp4.options[0]=new Option(group2[0][0].text,group2[0][0].value) // Pour tous les types existant alors affichage de tous les types for (i=0;i<=a;i++) { temp3.options[i]=new Option(group1[IDFA1][i].text,group1[IDFA1][i].value) } temp3.options[0].selected=true } function selecttype(form,z,variable1,variable2,numvente) { form.VTQTVT01.value=1; form.VTPTTC.value="0.00"; form.VTIDTA01.value=0; //taidty1 identifiant type taidty1=variable1 //temp4 formulaire tarif temp4=variable2 // enreg nombre d'enregistrement dans la table de tarification enreg='<? echo $nb_enregtarif;?>'; // Initialisation du gabarit pour les tarifs group2[0][0]=new Option("Selection-------"," "); // Pour tous les enregistrement de la base tarif // Si l'identifiant trouvé dans la base tarif correspont à l'identifiant du type selectionné // alors creation du tableau d'options tarif a=1 if(z!=0) { for (i=0;i<enreg;i++) { if(tableautarif["TAIDTY"][i]==taidty1) { lity=tableautarif["TAPTTC"][i] idty=tableautarif["TAIDTA"][i] group2[taidty1][0]=new Option("Selection-------"," "); group2[taidty1][a]=new Option(lity,idty); a++ } } // a prend la valeur du nombre de tarif dans le tableau d'option a=group2[taidty1].length } // a prend l'ancienne valeur du nombre de tarif dans le tableau d'option b=temp4.options.length // Si il n'y a pas de tarif correspondant au type if (a==0) { for (m=temp3.options.length-1;m>0;m--) temp4.options[m]=null temp4.options[0]=new Option(group2[0][0].text,group2[0][0].value) } for (m=temp4.options.length-1;m>0;m--) temp4.options[m]=null temp4.options[0]=new Option(group2[0][0].text,group2[0][0].value) if (z==0 && numvente==1) { form.VTIDTA01.value=0 form.VTQTVT01.value=1 } if(z!=0) { for (i=0;i<=a;i++) { temp4.options[i]=new Option(group2[taidty1][i].text,group2[taidty1][i].value) } } temp4.options[0].selected=true } function Recup01(form,b,c) { form.VTIDTA01.value=form.VTPTTC01.value; prix01=b; prix01=parseFloat(prix01); qte1=parseInt(form.VTQTVT01.value,10); valeurtotal=prix01*qte1; valeurtotal= Math.round (valeurtotal*100)/100; //Ajout des 0 apres la virgule valeurtotal=valeurtotal.toString(); montant_array=valeurtotal.split("."); if (!montant_array[1]) {valeurtotal=valeurtotal+".00";} else if (montant_array[1].length == 1) {valeurtotal=valeurtotal+"0";} form.VTPTTC.value=valeurtotal; } function CalculPrixTTC(form) { // form.VTIDFA1A.value=fa; // C'EST ICI LE PB form.VTIDTY1A.value=form.VTIDTY01.value; // form.VTPTTC1A.value=tc; // form.VTQTVT1A.value=vt; // form.VTIDTA1A.value=ta; prix01=parseFloat(prix01); qte1=parseInt(form.VTQTVT01.value,10); valeurtotal=prix01*qte1; valeurtotal= Math.round (valeurtotal*100)/100; //Ajout des 0 apres la virgule valeurtotal=valeurtotal.toString(); montant_array=valeurtotal.split("."); if (!montant_array[1]) {valeurtotal=valeurtotal+".00";} else if (montant_array[1].length == 1) {valeurtotal=valeurtotal+"0";} form.VTPTTC.value=valeurtotal; } </script>
Autres pages sur : recup texte valeur
Lassé par la pub ? Créez un compte
Lassé par la pub ? Créez un compte
.
de ton premier message et rajoute les balises.