Probleme affichage liste

cs_mechergui Messages postés 4 Date d'inscription vendredi 14 décembre 2007 Statut Membre Dernière intervention 23 mai 2011 - 12 août 2008 à 09:46
cs_mechergui Messages postés 4 Date d'inscription vendredi 14 décembre 2007 Statut Membre Dernière intervention 23 mai 2011 - 12 août 2008 à 10:16
bonjour tout le monde . je suis entrain de travailler sur des listes successives chacune alimente la suivante depuis son resultat , elle le ramene d'un fichier file (sans extension)
en local ca fonctionne nikel mais sur le serveur ca ne fonctionne pas (il ya des selections qui ne donnent pas de resultats a votre avis pk ?
merci

2 réponses

coucou747 Messages postés 12303 Date d'inscription mardi 10 février 2004 Statut Membre Dernière intervention 30 juillet 2012 44
12 août 2008 à 09:57
on peut voir ton code ? et savoir precisement ce qui ne fonctionne pas ? (un message d'erreur ? )
0
cs_mechergui Messages postés 4 Date d'inscription vendredi 14 décembre 2007 Statut Membre Dernière intervention 23 mai 2011
12 août 2008 à 10:16
voila c le contenu de ma page de test :

<?php
 include("foncts.php");
 

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Document sans titre</title>
</head>
">
            
        
        <?php
      //      writeError('pays', $result_basic);
        ?>
        ----

                            *Mon pays :&nbsp;                
            ,
                            <select rel="help_pays" name="pays" id="pays" onChange="ChangeCountry(this)" style="width: 200px">
                <?php
                   //MBJ
                    if(isset($_POST['pays']))
                    $country = $_POST['pays'];
                    else
                    {
                      $country = "France";
                      include('pays.php');
                       include('communes.php');
                      sort($pays);
                        
                    foreach($pays as $val) {
                        echo '<option value="'.$val.'"';
                        if($val == $country) echo ' selected="selected"';
                        echo '>'.$val.'</option>';
                    }
                   }    
                ?>
                </select>
            ,
        
        <?php
        //    writeError('commune', $result_basic);
            $csd = file_get_contents('communes');
            $communes = unserialize($csd);
            
            $commune = (isset($_POST['commune']) ? $_POST['commune'] : \"\");
            $region = (isset($_POST['region']) ? $_POST['region'] : \"\");
            $departement = (isset($_POST['departement']) ? $_POST['departement'] : \"\");
        ?>
        ----

                            *Ma région :&nbsp;
            ,
                        <select rel="help_pays" name="region" id="region" style="width: 200px" onChange="ChangeRegion(this)">
             <?php
             if($region == "")
             {
              ?>
              <option value="none">Choisir la region</option>
              <?php } ?>
              
                <?php
                    foreach($communes as $ind => $val)
                    {
                      echo '<option value="'.$ind.'"';
                      if($ind == $region)
                        echo ' selected="selected"';
                       echo '>'.$ind.'</option>';
                    }                    
                ?>
                            </select>
            ,
        
        ----

                         *Mon département :&nbsp;
           ,
                            <select rel="help_pays" name="departement" id="departement" onChange="ChangeDepartement(this)" style="width: 200px">
                <?php if($departement == "") { ?><option value="none" selected="selected">Choisir le département</option><?php } ?>                
                <?php
                                    if($region != "" && isset($communes[$region])) {
                                        foreach($communes[$region] as $ind => $val) {
                                            echo '<option value="'.$ind.'"';
                                            if($ind == $departement) echo ' selected="selected"';
                                            echo '>'.$ind.'</option>';
                                        }
                                    }
                                ?>            
                </select>
           ,
        
        ----

                         *Ma commune :&nbsp;
           ,
                
                <select rel="help_pays" name="commune" id="commune" style="width: 200px">
                <?php if($commune == "") { ?><option value="none">Choisir la commune</option><?php } ?>
                <?php
                                    if($region != "" && isset($communes[$region]) && $departement && isset($communes[$region][$departement])) {
                        foreach($communes[$region][$departement] as $val) {
                            echo '<option value="'.$val.'"';
                            if($val == $commune) echo ' selected="selected"';
                        echo '>'.$val.'</option>';
                    }
                    }
                            ?>
                </select>
           ,
        
----

                                     Ma ville :&nbsp;
                    ,
                                     " id="ville" rel="help_pays" />
           ,             
                
        
        

</html>

et voici la page contenant le sfonctions js :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Document sans titre</title>
<script>

var isDOM3 = (document.getElementById ? true : false);
var isIE43 = ((document.all && !isDOM3) ? true : false);
var isNS43 = (document.layers ? true : false);

function getRefio(id) {
    if (isDOM3) return document.getElementById(id);
    if (isIE43) return document.all[id];
    if (isNS43) return document.layers[id];
}

function GetLocations(selectObj, targetid, region, departement) {
    var idx = selectObj.selectedIndex;
    var which = selectObj.options[idx].value;

    var requestObj;   
    if(window.XMLHttpRequest)
        requestObj = new XMLHttpRequest();
    else if(window.ActiveXObject)
        requestObj = new ActiveXObject("Microsoft.XMLHTTP");
    else return false;
                       
    requestObj.open("GET", "getcommunes.php?region=" + escape(region) + "&departement=" + escape(departement), false);
    requestObj.send(null);
   
    var cList;   
    if(requestObj.readyState == 4) {
        cList = requestObj.responseText.split("#");
    }
   
    if(!cList) return false;
    var cSelect = getRefio(targetid);
    var len = cSelect.options.length;
    while (cSelect.options.length > 0) {
        cSelect.remove(0);
    }
   
    var newOption;
    for (var i=0; i<cList.length; i++) {
        newOption = document.createElement("option");
        newOption.value = cList[i];
    newOption.text = cList[i];
   
        try {
            cSelect.add(newOption);
        }
   
        catch (e) {
            cSelect.appendChild(newOption);
        }
    }
   
    return true;
}

function ChangeCountry(obj) {
    var id = obj.selectedIndex;
    var country = obj.options[id].value;

    var rowsFrance = ['row_region', 'row_departement', 'row_commune'];
    var rowsNonFrance = ['row_ville'];
   
    for(var i = 0; i < rowsFrance.length; i++) {
    if(country == "France") {
        getRefio(rowsFrance[i]).style.visibility = "visible";
        getRefio(rowsFrance[i]).style.display = "";
    } else {
        getRefio(rowsFrance[i]).style.visibility = "hidden";
            getRefio(rowsFrance[i]).style.display = "none";
    }
    }
   
    for(var i = 0; i < rowsNonFrance.length; i++) {
        if(country != "France") {
            getRefio(rowsNonFrance[i]).style.visibility = "visible";
            getRefio(rowsNonFrance[i]).style.display = "";
        } else {
            getRefio(rowsNonFrance[i]).style.visibility = "hidden";
            getRefio(rowsNonFrance[i]).style.display = "none";
        }
    }   
}

function ChangeRegion(obj) {
    var idreg = obj.selectedIndex;
    var region = obj.options[idreg].value;
    GetLocations(obj, 'departement', region, "", "");
    ChangeDepartement(getRefio('departement'));
}

function ChangeDepartement(obj) {
    var iddep = obj.selectedIndex;
    var departement = obj.options[iddep].value;   
    var objregion = getRefio('region');
   
    var idreg = objregion.selectedIndex;
    var region = objregion.options[idreg].value;
    GetLocations(obj, 'commune', region, departement, "");
}

function nbrChars(objid, countid) {
    getRefio(countid).innerHTML = getRefio(objid).value.length;
}

</script>
</head>

</html>

pays.php :

<?php
$pays = array("France","Suisse","Belgique","Allemagne","Danemark","Espagne","Italie",
"Portugal","Bulgarie","Hongrie","Finlande","Suède","Roumanie","Rép.Tchèque","Pologne",
"Pays-Bas","Norvège","Luxembourg","Royaume-Uni","Irlande","Grèce","Canada","Etats-Unis",
"Mexique","Cuba","Rép.Dominicaine","Haïti","Jamaïque","Argentine","Barbade","Bolivie",
"Belize","Brésil","Chili","Colombie","Costa Rica","Equateur","El Salvador","Grenade",
"Guadeloupe","Guatémala","Guyana","Guyane","Honduras","Martinique","Nicaragua","Panama",
"Paraguay","Pérou","Surinam","Uruguay","Vénézuéla","Australie","Nouvelle-Calédonie",
"Nouvelle-Zélande","Algérie","Afrique du Sud","Angola","Bénin","Botswana",
"Burkina Faso","Burundi","Cameroun","Cap-Vert","Centrafrique","Congo","Congo (RDC)",
"Côte-d'Ivoire","Djibouti","Erythrée","Ethiopie","Gabon","Gambie","Ghana","Guinée",
"Guinée Bissau","Guinée Equatoriale","Kenya","Ile Maurice","Lesotho","Libéria",
"Madagascar","Malawi","Mali","Maroc","Mauritanie","Mozambique","Namibie","Niger",
"Nigeria","Ouganda","Rwanda","Sao Tomé","Sénégal","Sierra Leone","Somalie","Soudan",
"Swaziland","Tanzanie","Tchad","Togo","Tunisie","Zambie","Zimbabwe","Arabie-Saoudite",
"Arménie","Bangladesh","Cambodge","Chine","Corée du nord","Corée du sud","Inde",
"Israël","Jordanie","Liban","Malaisie","Maldives","Mongolie","Népal","Pakistan",
"Paléstine","Philippines","Sri Lanka","Japon","Thaïlande","Russie","Québec");
?>

mais le fichier commune contient plaus qu un mega j peu pa le coller la et je sé pas comment le joindre
0
Rejoignez-nous