Hello All, I need to create a form where when a dropdown list is selected it auto populates a group of input values, so far I have this code but it seems to be getting the values but it is not adding the values to the input fields, any help would be greatly appreciated.
Jquery Code $(document).ready(function() { $("#charity_val").change(function(){ var charity = $("#charity_val").val(); $.post("ajax.php",{ charity_val: charity }, function(xml){ var address = $("address",xml).text(); alert(address); var suburb = $("suburb",xml).text(); var postcode = $("postcode",xml).text(); var state = $("state",xml).text(); var country = $("country",xml).text(); $("#charity_address").attr("value",address); $("#charity_suburb").attr("value",suburb); $("#charity_postcode").attr("value",postcode); $("#charity_state").attr("value",state); $("#charity_country").attr("value",country); }); }); }); php Code header('Content-Type: text/xml; charset=utf-8'); $value = $_REQUEST['charity_val']; $query = mysql_query("SELECT * FROM step_7_charities WHERE id_charity = {$value}"); while($row = mysql_fetch_array($query)) { $U['charity_address'] = $row['address']; $U['charity_suburb'] = $row['suburb']; $U['charity_postcode'] = $row['postcode']; $U['charity_state'] = $row['id_state']; $U['charity_country'] = $row['country']; } $returnXML = "<response><address>".$U['charity_address']."</ address><suburb>".$U['charity_suburb']."</suburb><postcode>". $U['charity_postcode']."</postcode><state>".$U['charity_state']."</ state><country>".$U['charity_country']."</country></response>"; echo $returnXML; Thankyou