hi all,

I want to use multiple select drop down box. I am using client,
project and activity. These all values are coming from database. I want when i select one client from first drop down box .Then second drop down box will display only that project which come under that client.


Like we does for country,city and state. If we select one country from first select box then it will show all state which come under that country. This type of application i want to make.


I know with ajax i can do this.
But what code should i use i do not know . So please help me. IT is very urgent for me.
Thanks,
Gagan

Hi all,

I am unable to solve my problem. So after trying so efforts . i am sending my code which i am using . After trying so much i am getting that where the problem is coming.

so problem is that where we are sending value of url through ajax code their it is not passing value of that. Due to that it can not be select value from the second drop down box which should come based on first select box.

I am using this code for index.php or ajax code i am sending .

I hope you will cooperate with me . You will try to solve my problem

<script language="javascript" type="text/javascript">
var xmlhttp;

function getProject(str)
{
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  }
var url="bookentry1.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)
{
//var mySplitResult = xmlhttp.responseText.split("|"); //updated
//document.getElementById("project1").value=mySplitResult[0];
//document.getElementById("id_project").value=mySplitResult[1];
document.getElementById('project1').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>

As i found that in this lin [TEX]url=url+"?q="+str;[/TEX]
when i am trying to print this value $_GET . IT is not giving value which should be correct value.

so pls help me to solve this. I will be very thankful to you for this.

Have you read the solution to the other thread? It's the exact same thing.

Try adding this to your <select> box:

<select onChange="getProject(this.value)">
  <option value="1">1</option>
  <option value="2">2</option>
  <option value="3">3</option>
</select>

.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.