Hi Pete Clark,

 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:

<?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.
 








Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to