Hi,

I've created a couple of dropdown boxes. The user selects their option from the first box and this activates an ajax call to populate the second box.

If the form doesn't validate and the page and form is reloaded, it remembers my selections.

However, it doesn't recognise that I have made a selection and the post data for that drop down is empty, which leads me to be believe that the page is not posting the data from the ajax generated drop down list.

I've checked my code and this is sound.

Any help is much appreciated.

Here's the html:

Code:
<select name="hotel_name_1" onchange="getLocations('1', this.value)">
<option>Select Hotel</option>
<!--LIST OF OPTIONS-->
</select>

<span id="locations1">
<select name="hotel_selection_1">
<option></option>
</select>
</span>
And here's the javascript:

Code:
<script 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 getLocations(selectid, hotelId)
{
   var strURL="_getLocations.php?id="+hotelId+"&section="+selectid;
   var req = getXMLHTTP();
   if (req)
   {
     req.onreadystatechange = function()
     {
      if (req.readyState == 4)
      {
	 // only if "OK"
	 if (req.status == 200)
         {
	    document.getElementById('locations'+selectid).innerHTML=req.responseText;
	 } else {
   	   alert("There was a problem while using XMLHTTP:\n" + req.statusText);
	 }
       }
      }
   req.open("GET", strURL, true);
   req.send(null);
   }
}
</script>