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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
|
<?php
session_start();
if(!empty($_SESSION['login']) AND !empty($_SESSION['psw']))
{
include 'connect_bdd\connection_BDD.php';
$login = ($_SESSION['login']);
$code = ($_SESSION['psw']);
//on test si la personne est un administrateur ou un client et si ils sont bien dans la base de donnée
$raq = "select ID_ADM from administrateur where LOGIN =\"$login\" and PASSWORD =\"$code\" ";
$rap = mysql_query($raq);
$bv = mysql_num_rows($rap);
if($bv != 0)
{
?>
<!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=utf-8" />
<title>Connection</title>
<script type="text/javascript" src="oXHR.js"></script>
<script type="text/javascript">
<!--
function request(oSelect) {
var value = oSelect.options[oSelect.selectedIndex].value;
var xhr = getXMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState == 4 && (xhr.status == 200 || xhr.status == 0)) {
readData(xhr.responseXML);
}
};
xhr.open("POST", "Ajax.php", true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.send("Departement=" + value);
}
function readData(oData) {
var nodes = oData.getElementsByTagName("item");
var oSelect = document.getElementById("Ville");
var oOption, oInner;
oSelect.innerHTML = "";
for (var i=0, c=nodes.length; i<c; i++) {
oOption = document.createElement("option");
oInner = document.createTextNode(nodes[i].getAttribute("name"));
oOption.value = nodes[i].getAttribute("id");
oOption.appendChild(oInner);
oSelect.appendChild(oOption);
}
}
</script>
</head>
<body>
<DIV ID=mv2></DIV>
<script LANGUAGE="JavaScript" SRC="ejs_menu_dyn_vert2.js"></script>
<h1>test</h1>
<form method="post" action="">
<table width="400" border="0" align="center" cellpadding="1" cellspacing="1">
<tr>
<td width="157">Département :</td>
<td width="236"><select name="Departement" id="Departement" onchange="request(this)";>
<?php
$roq = "select * from departement";
$rop = mysql_query($roq);
while ($ros = mysql_fetch_assoc($rop) )
{
echo "<option value='".$ros['ID_DEP']."'>".$ros['ID_DEP']." ".$ros['NOM_DEP']."</option>";
}
?>
</select></td>
</tr>
<tr>
<td width="236">Ville :</td>
<td width="236"> <select name="Ville" id="Ville"></select> </td>
</tr>
<tr>
<td> </td>
<td><input name="valider" type="submit" id="valider" value="Valider" /></td>
</tr>
</table>
</form>
<?php
include_once("..\pied.php");
?>
</body>
</html>
<?php
}
}
?> |