Hi frens..

I have a requirement, where the user selects a option from dropdown, depending on the option selected, the next 2-3 fields must get populated from data coming from db(this must happen without refresh) so i decided to use ajax.

I am getting a error which i am not able to get through.

ajax part

function getVendorInfo()
	var xmlhttp;
	if (window.XMLHttpRequest)
  	{// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	{// code for IE6, IE5
  	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");

	var selectedVendor = document.getElementById("vendor").value;
	//var url = "fetchVendorInfo.php?vendor="; 
       xmlhttp.open("POST", "fetchVendorInfo.php?vendor="+escape(selectedVendor), true); 
	  	if (xmlhttp.readyState==4 && xmlhttp.status==200)


	$selectedVendor = $_POST['vendor'];//this is the line causing error

	$db = mysql_connect("localhost", "***", "***") or die("Could not connect.");
   	die("no db");
	$SqlSelectedVendor = "Select * from company where relation='Vendor' and name='$selectedVendor'";
	$resVendor= mysql_query($SqlSelectedVendor);
	$rowDetail= mysql_fetch_array($resVendor);
	$vcontact = $rowDetail['address']."<br />".$rowDetail['city']."<br />".$rowDetail['state']."<br />".$rowDetail['pin']."<br />".$rowDetail['phone'];

error i get is
<br />
<b>Notice</b>: Undefined index: vendor in <b>/mnt/opt/lampp/htdocs/***/web/fetchVendorInfo.php</b> on line <b>3</b><br />

pls help me debug this, thanks ppl

i used jquery to get rid of this issue, i could not figure out where i was going wrong in this code, if anyone notices the issue, pls let me know, thanks

Be a part of the DaniWeb community

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