Code:
<?php
session_start();
?>
<!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>
<title></title>
<meta name="generator" content="Microsoft FrontPage 5.0" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<meta name="author" content="" />
<script languphase="javascript" type="text/javascript">
var xmlhttp;
function showUser(str)
{
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
{
alert ("Browser does not support HTTP Request");
return;
}
var url="rteg.php";
url=url+"?q="+str;
url=url+"&sid="+Math.random();
xmlhttp.onreadystatechange=stateChanged;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}
function stateChanged()
{
if (xmlhttp.readyState==4)
{
document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
}
}
function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
{
// code for IE7+, Firefox, Chrome, Opera, Safari
return new XMLHttpRequest();
}
if (window.ActiveXObject)
{
// code for IE6, IE5
return new ActiveXObject("Microsoft.XMLHTTP");
}
return null;
}
</script>
<script language="JavaScript" src="../../../include/common.js"></script>
<link rel="stylesheet" href="../../../include/style.css" type="text/css" />
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<div id="txtHint">
<?php
$scheme=$_GET['scheme'];
//$TR_State=$_GET['TR_State'];
//echo $TR_State;
if($scheme=="")
{
echo "<meta http-equiv='refresh' content='1; url=ngo.php'>";
}
require("../include/header.php"); ?>
<?php require("../include/left.php"); ?>
<div class="heading"> </div>
<div class="text">
<?php
require("../include/conn.php");
require("../include/dob.php");
require_once "../include/formvalidator.php";
//require_once "formvalidator.php";
?>
<table width="100%" align="left" cellpadding="0" cellspacing="0">
<form action="" method="POST" name="form1" onsubmit="return ValidateForm(this)">
some code
<tr valign="middle">
<td ><div align="left"></div></td>
<td><div align="left"></div></td>
<tr valign="middle">
<td > <div align="left">State</div></td>
<?php
//Select a User:
$q=$_GET["q"];
//echo $q;
//exit;
$q= mysql_real_escape_string($q);
if($q=="")
{
$q="assam";
}
$sql="SELECT distinct(state) FROM statedistrict";
$result = mysql_query($sql);
?>
<td> <div align="left">
<select name="TR_State" id="TR_State" onchange="showUser(this.value)">
<option value="<?php echo $q; ?>"><?php echo $q; ?></option>
<?php
while($row = mysql_fetch_array($result))
{ ?>
<option value="<?php echo $row[0]; ?>"><?php echo $row[0]; ?></option>
<?php }
?>
</select>
</div></td>
</tr>
<tr valign="middle">
<td ><div align="left"></div></td>
<td><div align="left"></div></td>
</tr>
<tr valign="middle">
<td > <div align="left">District</div></td>
<td> <div align="left">
<select name="TR_District" id="TR_District">
<?php
$sql="SELECT district FROM statedistrict WHERE state = '".$q."'";
?>
<?php
$result = mysql_query($sql);
while($row = mysql_fetch_array($result))
{
?>
<option value="<?php echo $row[0]; ?>"><?php echo $row[0]; ?></option>
<?php }
?>
</select>
</div></td>
</tr>
</form>
</table>
</div>
<?php require("../include/right.php"); ?><?php require("../include/footer.php"); ?>
</div></div></div></div>
</body>
</html>
Comment