Hi,

 

I have found a great AJAX form lookup script to auto populate form field
elements based on data entered from the first form element.

 

For those of you interested the above is located at 

 

http://www.dhtmlgoodies.com/index.html?page=ajax

http://www.dhtmlgoodies.com/scripts/ajax-client-lookup/ajax-client-lookup.ht
ml

http://www.dhtmlgoodies.com/index.html?whichScript=ajax_client_lookup

 

The only problem I the above requires the following few lines of php code to
run, yet it can be re written in cold fusion. As I am not familiar with
reading PHP code I was wondering if someone could lend a hand translating it
into equivalent cf code.

 

<?php
/* Replace the data in these two lines with data for your db connection */
$connection = mysql_connect("host","username","password");  
mysql_select_db("databaseName",$connection);

if(isset($_GET['getClientId'])){  
  $res = mysql_query("select * from ajax_client where
clientID='".$_GET['getClientId']."'") or die(mysql_error());
  if($inf = mysql_fetch_array($res)){
    echo "formObj.firstname.value = '".$inf["firstname"]."';\n";    
    echo "formObj.lastname.value = '".$inf["lastname"]."';\n";    
    echo "formObj.address.value = '".$inf["address"]."';\n";    
    echo "formObj.zipCode.value = '".$inf["zipCode"]."';\n";    
    echo "formObj.city.value = '".$inf["city"]."';\n";    
    echo "formObj.country.value = '".$inf["country"]."';\n";    
    
  }else{
    echo "formObj.firstname.value = '';\n";    
    echo "formObj.lastname.value = '';\n";    
    echo "formObj.address.value = '';\n";    
    echo "formObj.zipCode.value = '';\n";    
    echo "formObj.city.value = '';\n";    
    echo "formObj.country.value = '';\n";      
  }    
}
?>

 

 

 

Regards 

Claude Raiola 
B.Econ (Acc), B.Hot.Mngt. 

Websites: 

 <http://www.samaris.net> www.SAMARIS.NET 

Mobile: 0414 228 948

 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to