I have been created the 4 different sql method, the first is sqlSearchcust1: select * from customer where custid=<dtml-sqlvar custid type=string> AND custname=<dtml-sqlvar custname type=string> //This method will be call when i have to enter both exactly similar to custid and custname in order to search the record. second is sqlSearchcust2: select * from customer where custid="" AND custname LIKE "%<dtml-var custname>%" //This method will be call when i only enter the few words to search the custname of the records. third is sqlSearchcust3: select * from customer where custid=<dtml-sqlvar custid type=string> AND custname="" //This method will be call when i only enter on custid to search the records. If both empty it will link to another URL to display all the customer record. The problems is i'm not sure my dtml in order to control the loop of choosing the correct sql in the right situation. The following is my DTML:- <dtml-if "_["<dtml-var custid>"]==custid","_["<dtml-var custname>"]==custname"> <dtml-in sqlSearchcust1> </dtml-if> <dtml-elif "_[""]==custid","_["<dtml-var custname>"]==custname"> <dtml-in sqlSearchcust2> </dtml-if> <dtml-elif "_["<dtml-var custid>"]==custid","_[""]==custname"> <dtml-in sqlSearchcust3> </dtml-if> Please help me on correct the dtml Thank You! _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.