faqts : Computers : Programming : Languages : PHP

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

Entry

Function for checkavailablity of a username when a user click a hyperlink

Mar 28th, 2008 16:48
ha mo, vijesh Nair, Function for checkavailablity of a username when a user click a hyperlink


===================================================================
Java script Function for passing a value from one page to another(file
name say:index.php)
<script language="javascript">
function x()
{
   var y=document.form1.t.value;
 open("newtest.php?value="+y);
}
</script>
//Hyper link for check availablity
 <a href="#" onclick="javascript:x();">checkavailablity</a>
====================================================================
2nd page access this value (say file name: newtest.php)
 //after connecting to the database
 $get_value=$_REQUEST['value'];
        $query="select count(fname) as cv from pod.userdetails where
fname='$get_value'";
  $result=mysql_query($query);
 whille($row=mysql_fetch_array($result))
   {
     if($rows['cv']>=1)
		   {
		     echo "<font color='red'>Sorry username exist</font>";
		 }
		 else
		 {
		    echo "<font color='blue'>You can use this username</font>";
		 }
  }//while
http://www.tantofa.com
http://www.fantofa.com
http://www.mantofa.com
http://www.tanpola.com
http://www.tampola.com
http://www.yamot.com
http://www.mozmar.com
http://www.templatestemp.com