Hi Francis, Thnx 4 the hlp. But i already have the submit button which will invoke the register.php page...thats y i used a button which invokes javascript function(i know i'm complicating myself!)...which inturn invokes PHP function!!!...pls hlp me to simplify my code. here is my code: registration.php --------------- <?php include_once "siteincludes.php"; require_once "dbconnect.php"; function test($name) { $msg=""; $query="select * from tblusers where username='".$name."'"; $result=mysql_query($query); if(mysql_num_rows($result)==0) { $msg="<font color='green'>"."User ID is not available!"."</font>"; } else { $msg="<font color='red'>"."User ID is available!"."</font>"; }//end of else echo $msg; } ?> <body> <form name="registrationfrm" action="register.php" method="post"> User ID:<input type="text" name="cname"> <button onclick="checkuser()">Check Availability!</button> <h6 id='display' name='display'></h6> <script language=javascript> function checkuser(){ name=document.registrationfrm.cname.value; display.innerHTML="<?php $name='"+name+"'; test($name);?>"; } </script> </form> </body> Thanks, Danny. PHP Data object relational mapping generator http://www.metastorage.net/ Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/php-objects/ <*> To unsubscribe from this group, send an email to: php-objects-unsubscribe@xxxxxxxxxxxxxxx <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/