jonajona25
Gebruiker
- Lid geworden
- 15 okt 2009
- Berichten
- 41
hi
Ik heb de volgende script getoverd van het internet en op een logische wijze te inplementeren op mijn website, echter werkt het helaas niet. De waarden worden wel correct weergegeven, echter blijkt er geen connectie te zijn naar het tweede level. Waarschijnlijk een kwestie van een klein iets? Weet iemand raad? dan kan ik dit scriptje weer standaard maken voor de andere
Alvast dank mensen
Jonathan
----
<?
Database connectie.....
?>
<head>
<script language="javascript" type="text/javascript">
function getXMLHTTP() { //fuction to return the xml http object
var xmlhttp=false;
try{
xmlhttp=new XMLHttpRequest();
}
catch(e) {
try{
xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e){
try{
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e1){
xmlhttp=false;
}
}
}
return xmlhttp;
}
function getState(countryId) {
var strURL="findState.php?country="+countryId;
var req = getXMLHTTP();
if (req) {
req.onreadystatechange = function() {
if (req.readyState == 4) {
// only if "OK"
if (req.status == 200) {
document.getElementById('statediv').innerHTML=req.responseText;
} else {
alert("There was a problem while using XMLHTTP:\n" + req.statusText);
}
}
}
req.open("GET", strURL, true);
req.send(null);
}
}
function getCity(countryId,stateId) {
var strURL="findCity.php?country="+countryId+"&state="+stateId;
var req = getXMLHTTP();
if (req) {
req.onreadystatechange = function() {
if (req.readyState == 4) {
// only if "OK"
if (req.status == 200) {
document.getElementById('citydiv').innerHTML=req.responseText;
} else {
alert("There was a problem while using XMLHTTP:\n" + req.statusText);
}
}
}
req.open("GET", strURL, true);
req.send(null);
}
}
</script>
</head>
<body>
<form name="form2" method="post" action="">
<label for="select">Regions</label>
<p><br>
<select name="menu_regions" id="menu_regions" onChange="<? $countries=intval($_GET['name']);
?>">
<?php echo $row_rsCountries['name']; ?>
<?php
do {
?>
<option value="<?php echo $row_rsRegions['id']?>"<?php if (!(strcmp($row_rsRegions['id'], $row_rsCountries['regions_id']))) {echo "SELECTED";} ?>><?php echo $row_rsRegions['regions']?></option>
<?php
} while ($row_rsRegions = mysql_fetch_assoc($rsRegions));
$rows = mysql_num_rows($rsRegions);
if($rows > 0) {
mysql_data_seek($rsRegions, 0);
$row_rsRegions = mysql_fetch_assoc($rsRegions);
}
?>
</select>
<br>
<br>
<label for="select">Countries</label>
<br>
<select name="menu_countries" size="5" multiple id="menu_countries" onChange="<? $locations=intval($_GET['name']);
?>">
<?php echo $row_rsLocations['name']; ?>
<?php
do {
?>
<option value="<?php echo $row_rsCountries['id']; ?>"<?php if (!(strcmp($row_rsCountries['id'], $row_rsLocations['countries_id']))) {echo "SELECTED";} ?>><?php echo $row_rsCountries['name']?></option>
<?php
} while ($row_rsCountries = mysql_fetch_assoc($rsCountries));
$rows = mysql_num_rows($rsCountries);
if($rows > 0) {
mysql_data_seek($rsCountries, 0);
$row_rsCountries = mysql_fetch_assoc($rsCountries);
}
?>
</select>
</p>
<p>
<label for="label">Locations<br>
</label>
<select name="menu_locations" size="10" multiple id="menu_locations">
<?php
do {
?>
<option value="<?php echo $row_rsLocations['id']?>"<?php if (!(strcmp($row_rsLocations['id'], $row_rsLocations['name']))) {echo "SELECTED";} ?>><?php echo $row_rsLocations['name']?></option>
<?php
} while ($row_rsLocations = mysql_fetch_assoc($rsLocations));
$rows = mysql_num_rows($rsLocations);
if($rows > 0) {
mysql_data_seek($rsLocations, 0);
$row_rsLocations = mysql_fetch_assoc($rsLocations);
}
?>
</select>
</p>
</form>
</body>
Ik heb de volgende script getoverd van het internet en op een logische wijze te inplementeren op mijn website, echter werkt het helaas niet. De waarden worden wel correct weergegeven, echter blijkt er geen connectie te zijn naar het tweede level. Waarschijnlijk een kwestie van een klein iets? Weet iemand raad? dan kan ik dit scriptje weer standaard maken voor de andere

Alvast dank mensen
Jonathan
----
<?
Database connectie.....
?>
<head>
<script language="javascript" type="text/javascript">
function getXMLHTTP() { //fuction to return the xml http object
var xmlhttp=false;
try{
xmlhttp=new XMLHttpRequest();
}
catch(e) {
try{
xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e){
try{
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e1){
xmlhttp=false;
}
}
}
return xmlhttp;
}
function getState(countryId) {
var strURL="findState.php?country="+countryId;
var req = getXMLHTTP();
if (req) {
req.onreadystatechange = function() {
if (req.readyState == 4) {
// only if "OK"
if (req.status == 200) {
document.getElementById('statediv').innerHTML=req.responseText;
} else {
alert("There was a problem while using XMLHTTP:\n" + req.statusText);
}
}
}
req.open("GET", strURL, true);
req.send(null);
}
}
function getCity(countryId,stateId) {
var strURL="findCity.php?country="+countryId+"&state="+stateId;
var req = getXMLHTTP();
if (req) {
req.onreadystatechange = function() {
if (req.readyState == 4) {
// only if "OK"
if (req.status == 200) {
document.getElementById('citydiv').innerHTML=req.responseText;
} else {
alert("There was a problem while using XMLHTTP:\n" + req.statusText);
}
}
}
req.open("GET", strURL, true);
req.send(null);
}
}
</script>
</head>
<body>
<form name="form2" method="post" action="">
<label for="select">Regions</label>
<p><br>
<select name="menu_regions" id="menu_regions" onChange="<? $countries=intval($_GET['name']);
?>">
<?php echo $row_rsCountries['name']; ?>
<?php
do {
?>
<option value="<?php echo $row_rsRegions['id']?>"<?php if (!(strcmp($row_rsRegions['id'], $row_rsCountries['regions_id']))) {echo "SELECTED";} ?>><?php echo $row_rsRegions['regions']?></option>
<?php
} while ($row_rsRegions = mysql_fetch_assoc($rsRegions));
$rows = mysql_num_rows($rsRegions);
if($rows > 0) {
mysql_data_seek($rsRegions, 0);
$row_rsRegions = mysql_fetch_assoc($rsRegions);
}
?>
</select>
<br>
<br>
<label for="select">Countries</label>
<br>
<select name="menu_countries" size="5" multiple id="menu_countries" onChange="<? $locations=intval($_GET['name']);
?>">
<?php echo $row_rsLocations['name']; ?>
<?php
do {
?>
<option value="<?php echo $row_rsCountries['id']; ?>"<?php if (!(strcmp($row_rsCountries['id'], $row_rsLocations['countries_id']))) {echo "SELECTED";} ?>><?php echo $row_rsCountries['name']?></option>
<?php
} while ($row_rsCountries = mysql_fetch_assoc($rsCountries));
$rows = mysql_num_rows($rsCountries);
if($rows > 0) {
mysql_data_seek($rsCountries, 0);
$row_rsCountries = mysql_fetch_assoc($rsCountries);
}
?>
</select>
</p>
<p>
<label for="label">Locations<br>
</label>
<select name="menu_locations" size="10" multiple id="menu_locations">
<?php
do {
?>
<option value="<?php echo $row_rsLocations['id']?>"<?php if (!(strcmp($row_rsLocations['id'], $row_rsLocations['name']))) {echo "SELECTED";} ?>><?php echo $row_rsLocations['name']?></option>
<?php
} while ($row_rsLocations = mysql_fetch_assoc($rsLocations));
$rows = mysql_num_rows($rsLocations);
if($rows > 0) {
mysql_data_seek($rsLocations, 0);
$row_rsLocations = mysql_fetch_assoc($rsLocations);
}
?>
</select>
</p>
</form>
</body>
Laatst bewerkt: