Friday, 21 August 2015


 CREATE TABLE IF NOT EXISTS `employee` (  
  `EMPLOYEE_ID` int(25) NOT NULL,  
  `FIRST_NAME` varchar(255) NOT NULL,  
  `LAST_NAME` varchar(255) NOT NULL,  
  `EMPLOYEE_EMAIL` varchar(255) NOT NULL,  
  `PASSWORD` varchar(50) DEFAULT NULL,  
 ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;  
 CREATE TABLE IF NOT EXISTS `TOKEN` (  
  `ID` int(11) NOT NULL AUTO_INCREMENT,  
  `EMPLOYEE_EMAIL` varchar(100) NOT NULL,  
  `TOKEN` varchar(100) NOT NULL,  
  `STATUS` int(11) NOT NULL DEFAULT '0',  
  PRIMARY KEY (`ID`)  
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ;  

Step1:
Create Form:


 <form method="post" name="forgot" id="forgot">  
        <!-- Modal -->  
        <div aria-hidden="true" aria-labelledby="myModalLabel" role="dialog" tabindex="-1" id="forgotPass" class="modal fade">  
          <div class="modal-dialog">  
            <div class="modal-content">  
              <div class="modal-header">  
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>  
                <h4 class="modal-title">Forgot Password ?</h4>  
              </div>  
              <div class="modal-body">  
                <p>Enter your e-mail address below to reset your password.</p>  
                <input type="text" name="email2" id="email2" placeholder="Email" autocomplete="off" class="form-control placeholder-no-fix">  
              </div>  
              <div class="modal-footer">  
                <button data-dismiss="modal" class="btn btn-default" type="button">Cancel</button>  
                                     <input type="submit" value="Send" name="send" class="btn btn-success">  
                <!-- <button class="btn btn-success" type="button">Submit</button>-->  
              </div>  
            </div>  
          </div>  
        </div>  
        <!-- modal -->  
      </form>  

Step2:

Checking Entered  Email is Existed or not  and Sent  Reset password mail if mail is already Existed



 <?php  
 $conn=mysql_connect("hostname","username","password")  
 mysql_select_db("databasename",$conn);  
 if(isset($_POST['send'])) {  
 $email=$_POST['email2'];  
  $sql="SELECT EMPLOYEE_ID,EMPLOYEE_EMAIL,PASSWORD from EMPLOYEE where EMPLOYEE_EMAIL='".$email."'";  
 $q=mysql_query($sql);       
  $p=mysql_affected_rows();  
  if($p!=0)   
   {  
   $res=mysql_fetch_array($q);  
  $to=$res['EMPLOYEE_EMAIL'];  
  $token=rand();  
 $q="insert into TOKEN (TOKEN,EMPLOYEE_EMAIL) values ('".$token."','".$email."')";  
 mysql_query($q);  
  $subject=' password Recovery';  
     $from  = 'FAD@imcrinox.com';   // give from email address   
      // mandatory headers for email message, change if you need something different in your setting.   
      $headers = "From: " . $from . "\r\n";   
      $headers .= "Reply-To: ". $from . "\r\n";   
      $headers .= "CC: arundsti@gmail.com\r\n";   
      $headers .= "MIME-Version: 1.0\r\n";   
      $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";   
  $message = '<html><body>';  
  $message .= '<span style="color:Green;font-size:20px;"> PASSWORD RECOVERY</span> ';  
  $message .= '<table rules="all" border=1 style="border-color: green;" cellpadding="10" align="center">';  
  $message .= "<tr style='background: #eee;'><td><strong>Email:</strong> </td><td>" . strip_tags($res['EMPLOYEE_EMAIL']) . "</td></tr>";  
  $message .= "<tr><td><strong>PASSWORD:</strong> </td><td>" . "<a href='http://website.com/foldername/subfoldername/reset.php?token=$token'>ResetPassword</a>" . "</td></tr>";  
  $message .= "</table>";  
  $message .= "</body></html>";  
  $m=mail($to,$subject,$message,$headers);  
  if($m)  
       {  
        $msg='Check your mail inbox for Reset password ';  
       }  
  else  
       {  
        $msg='Email not found please signup now!!';  
       }  
   }  
    else  
  {  
  $msg='Invalid Email';  
  }  
 }   
 ?>  
Step3:
Checking mail

reset.php

 <?php session_start();  
 $token=$_GET['token'];  
 if(!isset($_POST['password'])){  
  $q="select EMPLOYEE_EMAIL from TOKEN where TOKEN='".$token."' and STATUS=0";  
 $r=mysql_query($q);  
 while($row=mysql_fetch_array($r))  
   {  
 $email=$row['EMPLOYEE_EMAIL'];  
   }  
 If ($email!=''){  
      $_SESSION['EMPLOYEE_EMAIL']=$email;  
 }  
 else die("Invalid link or Password already changed<a href='index.php'>Login here</a>");}  
 $pass=$_POST['password'];  
 $email=$_SESSION['EMPLOYEE_EMAIL'];  
 if(!isset($pass)){  
 echo '<form method="post">  
 enter your new password:<input type="password" name="password" />  
 <input type="submit" value="Change Password">  
 </form>  
 ';}  
 if(isset($_POST['password']))  
 {  
 $q="update EMPLOYEE set PASSWORD='".$pass."' where EMPLOYEE_EMAIL='".$email."'";  
 $r=mysql_query($q);  
 if($r)mysql_query("update TOKEN set STATUS=1 where TOKEN='".$token."'");  
 echo "Your password is changed successfully<a href='index.php'>Login Here</a>";  
 if(!$r)echo "An error occurred";  
      }  
      ?>  
php

reset password php

Posted by D. arunkumar  |  No comments


 CREATE TABLE IF NOT EXISTS `employee` (  
  `EMPLOYEE_ID` int(25) NOT NULL,  
  `FIRST_NAME` varchar(255) NOT NULL,  
  `LAST_NAME` varchar(255) NOT NULL,  
  `EMPLOYEE_EMAIL` varchar(255) NOT NULL,  
  `PASSWORD` varchar(50) DEFAULT NULL,  
 ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;  
 CREATE TABLE IF NOT EXISTS `TOKEN` (  
  `ID` int(11) NOT NULL AUTO_INCREMENT,  
  `EMPLOYEE_EMAIL` varchar(100) NOT NULL,  
  `TOKEN` varchar(100) NOT NULL,  
  `STATUS` int(11) NOT NULL DEFAULT '0',  
  PRIMARY KEY (`ID`)  
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ;  

Step1:
Create Form:


 <form method="post" name="forgot" id="forgot">  
        <!-- Modal -->  
        <div aria-hidden="true" aria-labelledby="myModalLabel" role="dialog" tabindex="-1" id="forgotPass" class="modal fade">  
          <div class="modal-dialog">  
            <div class="modal-content">  
              <div class="modal-header">  
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>  
                <h4 class="modal-title">Forgot Password ?</h4>  
              </div>  
              <div class="modal-body">  
                <p>Enter your e-mail address below to reset your password.</p>  
                <input type="text" name="email2" id="email2" placeholder="Email" autocomplete="off" class="form-control placeholder-no-fix">  
              </div>  
              <div class="modal-footer">  
                <button data-dismiss="modal" class="btn btn-default" type="button">Cancel</button>  
                                     <input type="submit" value="Send" name="send" class="btn btn-success">  
                <!-- <button class="btn btn-success" type="button">Submit</button>-->  
              </div>  
            </div>  
          </div>  
        </div>  
        <!-- modal -->  
      </form>  

Step2:

Checking Entered  Email is Existed or not  and Sent  Reset password mail if mail is already Existed



 <?php  
 $conn=mysql_connect("hostname","username","password")  
 mysql_select_db("databasename",$conn);  
 if(isset($_POST['send'])) {  
 $email=$_POST['email2'];  
  $sql="SELECT EMPLOYEE_ID,EMPLOYEE_EMAIL,PASSWORD from EMPLOYEE where EMPLOYEE_EMAIL='".$email."'";  
 $q=mysql_query($sql);       
  $p=mysql_affected_rows();  
  if($p!=0)   
   {  
   $res=mysql_fetch_array($q);  
  $to=$res['EMPLOYEE_EMAIL'];  
  $token=rand();  
 $q="insert into TOKEN (TOKEN,EMPLOYEE_EMAIL) values ('".$token."','".$email."')";  
 mysql_query($q);  
  $subject=' password Recovery';  
     $from  = 'FAD@imcrinox.com';   // give from email address   
      // mandatory headers for email message, change if you need something different in your setting.   
      $headers = "From: " . $from . "\r\n";   
      $headers .= "Reply-To: ". $from . "\r\n";   
      $headers .= "CC: arundsti@gmail.com\r\n";   
      $headers .= "MIME-Version: 1.0\r\n";   
      $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";   
  $message = '<html><body>';  
  $message .= '<span style="color:Green;font-size:20px;"> PASSWORD RECOVERY</span> ';  
  $message .= '<table rules="all" border=1 style="border-color: green;" cellpadding="10" align="center">';  
  $message .= "<tr style='background: #eee;'><td><strong>Email:</strong> </td><td>" . strip_tags($res['EMPLOYEE_EMAIL']) . "</td></tr>";  
  $message .= "<tr><td><strong>PASSWORD:</strong> </td><td>" . "<a href='http://website.com/foldername/subfoldername/reset.php?token=$token'>ResetPassword</a>" . "</td></tr>";  
  $message .= "</table>";  
  $message .= "</body></html>";  
  $m=mail($to,$subject,$message,$headers);  
  if($m)  
       {  
        $msg='Check your mail inbox for Reset password ';  
       }  
  else  
       {  
        $msg='Email not found please signup now!!';  
       }  
   }  
    else  
  {  
  $msg='Invalid Email';  
  }  
 }   
 ?>  
Step3:
Checking mail

reset.php

 <?php session_start();  
 $token=$_GET['token'];  
 if(!isset($_POST['password'])){  
  $q="select EMPLOYEE_EMAIL from TOKEN where TOKEN='".$token."' and STATUS=0";  
 $r=mysql_query($q);  
 while($row=mysql_fetch_array($r))  
   {  
 $email=$row['EMPLOYEE_EMAIL'];  
   }  
 If ($email!=''){  
      $_SESSION['EMPLOYEE_EMAIL']=$email;  
 }  
 else die("Invalid link or Password already changed<a href='index.php'>Login here</a>");}  
 $pass=$_POST['password'];  
 $email=$_SESSION['EMPLOYEE_EMAIL'];  
 if(!isset($pass)){  
 echo '<form method="post">  
 enter your new password:<input type="password" name="password" />  
 <input type="submit" value="Change Password">  
 </form>  
 ';}  
 if(isset($_POST['password']))  
 {  
 $q="update EMPLOYEE set PASSWORD='".$pass."' where EMPLOYEE_EMAIL='".$email."'";  
 $r=mysql_query($q);  
 if($r)mysql_query("update TOKEN set STATUS=1 where TOKEN='".$token."'");  
 echo "Your password is changed successfully<a href='index.php'>Login Here</a>";  
 if(!$r)echo "An error occurred";  
      }  
      ?>  

03:17 Share:

Sunday, 21 December 2014

This tutorial we will see how to send a activation mail after signup using php

Create table mailinsert
 CREATE TABLE IF NOT EXISTS `mailinsert` (  
  `sno` int(11) NOT NULL AUTO_INCREMENT,  
  `name` varchar(50) NOT NULL,  
  `email` varchar(50) NOT NULL,  
  `password` varchar(50) NOT NULL,  
  `city` varchar(50) NOT NULL,  
  `status` int(11) NOT NULL,  
  `code` varchar(50) NOT NULL,  
  PRIMARY KEY (`sno`)  
 ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;  


mailact.php

 <?php  
 $con=mysql_connect("hostname","username","password");  
 mysql_select_db("databasename",$con);  
 $name=$_POST['name'];  
 $email=$_POST['email'];  
 $password=$_POST['password'];  
 $city=$_POST['city'];  
 $status=1;  
 $code=rand();  
 if(isset($_POST['submit'])){  
  $sql="insert into mailinsert(sno,name,email,password,city,status,code)values('','$name','$email','$password','$city','$status','$code')";  
 $res=mysql_query($sql);  
 if($res)  
 {  
      echo "inserted";  
 $subject = "Email Verification - Codetipz";  
      $message = "Hi $name<br /> <br />  
      Thankyou for registration with Codetipz. Please <a href='http://yourwebsite.com/verify.php?code=$code'>Click Here to verify your Email ID</a> <br /><br />  
      Best Regards<br />  
      Justcourse  
      ";       
 $cemail="admin@codetipz.blogspot.in";  
      $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";  
                     // Additional headers  
                     $headers .= 'From: '.$cemail . "\r\n";  
                     $headers .= 'Reply-To: '.$cemail . "\r\n";  
                     $to = $email;  
                     if(mail($to, $subject, $message, $headers))  
                     {  
                     echo "<script>alert('You Have Successfully Registered, An Verification Email Sent To Your Email. Please Verify Your Email And Access Your Account')</script>";  
                     }  
 }  
 }  
 ?>  
 <style type="text/css">  
 table {  
      background:#BADCE0;  
      border-radius:10px;  
      margin-top:150px;  
 }  
 </style>  
 <form method="post" action="">  
 <table width="200" align="center">  
  <tr>  
   <td>Name</td>  
   <td><input type="text" name="name" id="name"></td>  
  </tr>  
  <tr>  
   <td>Email:</td>  
   <td><input type="text" name="email" id="email"></td>  
  </tr>  
  <tr>  
   <td>Password:</td>  
   <td><input type="password" name="password" id="password"></td>  
  </tr>  
  <tr>  
   <td>City:</td>  
   <td><select name="city" id="city">  
   <option value="">Select City</option>  
   <option value="city1">city1</option>  
   <option value="city2">city2</option>  
   <option value="city3">city3</option>  
   <option value="city4">city4</option>  
   </select>  
   </td>  
  </tr>  
  <tr>  
   <td align="center" colspan="2"><input type="submit" name="submit" id="submit" value="Register"></td>  
  </tr>  
 </table>  
 </form>  

verify.php

 <?php  
 $con=mysql_connect("hostname","username","password");  
 mysql_select_db("databasename",$con);  
 $code=$_GET['code'];  
 $sql1 = "select * from mailinsert where code = '$code'";  
       $result = mysql_query($sql1);  
       if(mysql_num_rows($result) != 0)  
       {  
 $sql="update mailinsert set status='0' where code='$code'";  
 $upd=mysql_query($sql);  
 if($upd)  
 {  
         echo "<script><alert><h3>Your Email Has Been Succssfully Verified. Please Login And Access Your Account</h3></alert></script>";  
 }  
 }  
 else  
 {  
 echo "invalid request";       
 }  
 ?>  
php

php email verification script

Posted by D. arunkumar  |  No comments

This tutorial we will see how to send a activation mail after signup using php

Create table mailinsert
 CREATE TABLE IF NOT EXISTS `mailinsert` (  
  `sno` int(11) NOT NULL AUTO_INCREMENT,  
  `name` varchar(50) NOT NULL,  
  `email` varchar(50) NOT NULL,  
  `password` varchar(50) NOT NULL,  
  `city` varchar(50) NOT NULL,  
  `status` int(11) NOT NULL,  
  `code` varchar(50) NOT NULL,  
  PRIMARY KEY (`sno`)  
 ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;  


mailact.php

 <?php  
 $con=mysql_connect("hostname","username","password");  
 mysql_select_db("databasename",$con);  
 $name=$_POST['name'];  
 $email=$_POST['email'];  
 $password=$_POST['password'];  
 $city=$_POST['city'];  
 $status=1;  
 $code=rand();  
 if(isset($_POST['submit'])){  
  $sql="insert into mailinsert(sno,name,email,password,city,status,code)values('','$name','$email','$password','$city','$status','$code')";  
 $res=mysql_query($sql);  
 if($res)  
 {  
      echo "inserted";  
 $subject = "Email Verification - Codetipz";  
      $message = "Hi $name<br /> <br />  
      Thankyou for registration with Codetipz. Please <a href='http://yourwebsite.com/verify.php?code=$code'>Click Here to verify your Email ID</a> <br /><br />  
      Best Regards<br />  
      Justcourse  
      ";       
 $cemail="admin@codetipz.blogspot.in";  
      $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";  
                     // Additional headers  
                     $headers .= 'From: '.$cemail . "\r\n";  
                     $headers .= 'Reply-To: '.$cemail . "\r\n";  
                     $to = $email;  
                     if(mail($to, $subject, $message, $headers))  
                     {  
                     echo "<script>alert('You Have Successfully Registered, An Verification Email Sent To Your Email. Please Verify Your Email And Access Your Account')</script>";  
                     }  
 }  
 }  
 ?>  
 <style type="text/css">  
 table {  
      background:#BADCE0;  
      border-radius:10px;  
      margin-top:150px;  
 }  
 </style>  
 <form method="post" action="">  
 <table width="200" align="center">  
  <tr>  
   <td>Name</td>  
   <td><input type="text" name="name" id="name"></td>  
  </tr>  
  <tr>  
   <td>Email:</td>  
   <td><input type="text" name="email" id="email"></td>  
  </tr>  
  <tr>  
   <td>Password:</td>  
   <td><input type="password" name="password" id="password"></td>  
  </tr>  
  <tr>  
   <td>City:</td>  
   <td><select name="city" id="city">  
   <option value="">Select City</option>  
   <option value="city1">city1</option>  
   <option value="city2">city2</option>  
   <option value="city3">city3</option>  
   <option value="city4">city4</option>  
   </select>  
   </td>  
  </tr>  
  <tr>  
   <td align="center" colspan="2"><input type="submit" name="submit" id="submit" value="Register"></td>  
  </tr>  
 </table>  
 </form>  

verify.php

 <?php  
 $con=mysql_connect("hostname","username","password");  
 mysql_select_db("databasename",$con);  
 $code=$_GET['code'];  
 $sql1 = "select * from mailinsert where code = '$code'";  
       $result = mysql_query($sql1);  
       if(mysql_num_rows($result) != 0)  
       {  
 $sql="update mailinsert set status='0' where code='$code'";  
 $upd=mysql_query($sql);  
 if($upd)  
 {  
         echo "<script><alert><h3>Your Email Has Been Succssfully Verified. Please Login And Access Your Account</h3></alert></script>";  
 }  
 }  
 else  
 {  
 echo "invalid request";       
 }  
 ?>  

09:04 Share:

Sunday, 9 November 2014


jquery

form validation jquery

Posted by D. arunkumar  |  No comments


21:05 Share:

Sunday, 19 October 2014




 CREATE TABLE IF NOT EXISTS `list` (  
 `sno` int(11) NOT NULL,  
  `name` varchar(50) NOT NULL,  
  `email` varchar(50) NOT NULL,  
  `password` varchar(50) NOT NULL,  
  `gender` varchar(10) NOT NULL,  
  `location` varchar(30) NOT NULL  
 ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;  
dbinsert.php
 <style type="text/css">  
 #register {  
      background:#9DBE78;  
      width:19.5%;  
      margin-left:15px;  
      border:groove  
 }  
 </style>  
 <script type="text/javascript" src="validation.js"></script>  
 <?php  
 $conn=mysql_connect("localhost","root","");  
 mysql_select_db("mytest",$conn);  
 @$name=$_POST['name'];  
 @$email=$_POST['email'];  
 @$password=$_POST['pwd'];  
 @$gender=$_POST['gender'];  
 @$location=$_POST['location'];  
 if(isset($_POST['register']))  
 {  
  $sql="insert into list(sno,name,email,password,gender,location) values('','$name','$email','$password','$gender','$location')";  
 $res=mysql_query($sql);  
 if($res)  
 {  
 echo "Inserted";       
 }  
 else  
 {  
 echo "Not Inserted";       
 }  
 }  
 ?>  
 <div id="register">  
 <form method="post" name="register" action="" onSubmit="return validate()">  
 <table width="200" border="0">  
  <tr>  
   <td>Name:</td>  
   <td><input type="text" name="name" id="name"></td>  
  </tr>  
  <tr>  
   <td>Email:</td>  
   <td><input type="text" name="email" id="email"></td>  
  </tr>  
  <tr>  
   <td>Password:</td>  
   <td><input type="password" name="pwd" id="pwd"></td>  
  </tr>  
  <tr>  
   <td>Gender:</td>  
   <td><input type="radio" name="gender" id="gender" value="male">Male  
   <input type="radio" name="gender" id="gender" value="female">FeMale  
   </td>  
  </tr>  
  <tr>  
   <td>Location:</td>  
   <td><select name="location" >   
   <option value="-1">Select</option>  
   <option value="delhi">Delhi</option>  
   <option value="vijayawada">Vijayawada</option>  
   <option value="bangalore">Bangalore</option>  
   </select>  
   </td>  
  </tr>  
  <tr>  
   <td colspan="2" align="center"><input type="submit" name="register" id="register" value="Insert"></td>  
  </tr>  
 </table>  
 </form>  
 </div>  

validation.js

 function validate()  
 {  
      var d=document.register;  
      if(d.name.value == "")  
      {  
      alert("Please Enter Name");  
      d.name.focus();  
      return false;       
      }  
      if(d.email.value == "")  
      {  
      alert("Please Enter Email");  
      d.email.focus();  
      return false;       
      }  
      if(d.pwd.value == "")  
      {  
      alert("Please Enter Password");  
      d.pwd.focus();  
      return false;       
      }  
      if(d.gender[0].checked == false && d.gender[1].checked == false)  
      {  
      alert("Please Select Gender");  
      return false;       
      }  
      if(d.location.value == -1)  
      {  
           alert("Please Select Location");  
           return false;  
      }  
      return true;  
 }  
Inserted data in database table:

php

insert into database php

Posted by D. arunkumar  |  No comments




 CREATE TABLE IF NOT EXISTS `list` (  
 `sno` int(11) NOT NULL,  
  `name` varchar(50) NOT NULL,  
  `email` varchar(50) NOT NULL,  
  `password` varchar(50) NOT NULL,  
  `gender` varchar(10) NOT NULL,  
  `location` varchar(30) NOT NULL  
 ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;  
dbinsert.php
 <style type="text/css">  
 #register {  
      background:#9DBE78;  
      width:19.5%;  
      margin-left:15px;  
      border:groove  
 }  
 </style>  
 <script type="text/javascript" src="validation.js"></script>  
 <?php  
 $conn=mysql_connect("localhost","root","");  
 mysql_select_db("mytest",$conn);  
 @$name=$_POST['name'];  
 @$email=$_POST['email'];  
 @$password=$_POST['pwd'];  
 @$gender=$_POST['gender'];  
 @$location=$_POST['location'];  
 if(isset($_POST['register']))  
 {  
  $sql="insert into list(sno,name,email,password,gender,location) values('','$name','$email','$password','$gender','$location')";  
 $res=mysql_query($sql);  
 if($res)  
 {  
 echo "Inserted";       
 }  
 else  
 {  
 echo "Not Inserted";       
 }  
 }  
 ?>  
 <div id="register">  
 <form method="post" name="register" action="" onSubmit="return validate()">  
 <table width="200" border="0">  
  <tr>  
   <td>Name:</td>  
   <td><input type="text" name="name" id="name"></td>  
  </tr>  
  <tr>  
   <td>Email:</td>  
   <td><input type="text" name="email" id="email"></td>  
  </tr>  
  <tr>  
   <td>Password:</td>  
   <td><input type="password" name="pwd" id="pwd"></td>  
  </tr>  
  <tr>  
   <td>Gender:</td>  
   <td><input type="radio" name="gender" id="gender" value="male">Male  
   <input type="radio" name="gender" id="gender" value="female">FeMale  
   </td>  
  </tr>  
  <tr>  
   <td>Location:</td>  
   <td><select name="location" >   
   <option value="-1">Select</option>  
   <option value="delhi">Delhi</option>  
   <option value="vijayawada">Vijayawada</option>  
   <option value="bangalore">Bangalore</option>  
   </select>  
   </td>  
  </tr>  
  <tr>  
   <td colspan="2" align="center"><input type="submit" name="register" id="register" value="Insert"></td>  
  </tr>  
 </table>  
 </form>  
 </div>  

validation.js

 function validate()  
 {  
      var d=document.register;  
      if(d.name.value == "")  
      {  
      alert("Please Enter Name");  
      d.name.focus();  
      return false;       
      }  
      if(d.email.value == "")  
      {  
      alert("Please Enter Email");  
      d.email.focus();  
      return false;       
      }  
      if(d.pwd.value == "")  
      {  
      alert("Please Enter Password");  
      d.pwd.focus();  
      return false;       
      }  
      if(d.gender[0].checked == false && d.gender[1].checked == false)  
      {  
      alert("Please Select Gender");  
      return false;       
      }  
      if(d.location.value == -1)  
      {  
           alert("Please Select Location");  
           return false;  
      }  
      return true;  
 }  
Inserted data in database table:

22:26 Share:

Saturday, 18 October 2014

 <?php  
 $string="Hello world,have a nice day";  
 $length=strlen($string);  
 echo "Length is".$string;  
 ?>  



php

php string length

Posted by D. arunkumar  |  No comments

 <?php  
 $string="Hello world,have a nice day";  
 $length=strlen($string);  
 echo "Length is".$string;  
 ?>  



10:05 Share:

Thursday, 16 October 2014

 <script type="text/javascript" src="">  
 function validate()  
 {  
      var d=document.register;  
      var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;  
      if(d.cn.value == '')  
      {  
           alert("Enter Name");  
           d.cn.focus();  
           return false;  
      }  
      if(d.cn.value.length<=2)  
      {  
      alert("Minimum Name Should be greater than two");  
      return false;       
      }  
      if(d.email.value == '')  
      {  
      alert("Email is is Required");  
      d.email.focus();  
      return false;       
      }  
      if(reg.test(d.email.value) == false)  
      {  
      alert("Invalid Email");  
      return false;       
      }  
      if(d.password.value == '')  
      {  
      alert("Password is is Required");  
      d.password.focus();  
      return false;       
      }  
      if(d.password.value != d.cpassword.value)  
      {  
      alert("Passwords Mismatch")  
      return false;       
      }  
      if(d.year.value == 1)  
      {  
      alert("Select Year");  
      return false;       
      }  
      if(d.gender[0].checked == false && d.gender[1].checked == false)  
      {  
      alert("Select Gender");  
      return false;       
      }  
      if(d.terms.checked == false)  
      {  
      alert("Accept terms");  
      return false;       
      }  
 }  
 </script>  
 <form name="register" method="post" onSubmit="return validate()">  
 <table width="200" border="1" align="center">  
  <tr>  
   <td>CompanyName<span style="color:red">*</span>:</td>  
   <td><input type="text" name="cn" id="cn"></td>  
  </tr>  
  <tr>  
   <td>Email<span style="color:red">*</span>:</td>  
   <td><input type="text" name="email" id="email"></td>  
  </tr>  
  <tr>  
   <td>Password<span style="color:red">*</span>:</td>  
   <td><input type="password" name="password" id="password"></td>  
  </tr>  
  <tr>  
   <td>Confirm-Password:</td>  
   <td><input type="password" name="cpassword" id="cpassword"></td>  
  </tr>  
  <tr>  
   <td>Year<span style="color:red">*</span>:</td>  
   <td>  
   <select name="year" id="year">  
   <option value="1">Select</option>  
   <?php for($i=1999;$i<=date(Y);$i++) { ?>  
   <option value="<?php echo $i ?>"><?php echo $i ?></option>  
   <?Php } ?>  
   </select>  
   </td>  
  </tr>  
  <tr>  
   <td>Gender<span style="color:red">*</span>:</td>  
   <td><input type="radio" name="gender" id="gender">Male  
   <input type="radio" name="gender" id="gender">FeMale</td>  
  </tr>  
  <tr>  
  <td colspan="2"><input type="checkbox" name="terms" id="terms">  
  I Accepted the <a href="terms.php">terms&conditions</a></td>  
  </tr>  
  <tr>  
   <td colspan="2" align="center"><input type="submit" name="submit" id="submit" value="Register"></td>  
  </tr>  
 </table>  
 </form>  

html

html registration form with validation

Posted by D. arunkumar  |  3 comments

 <script type="text/javascript" src="">  
 function validate()  
 {  
      var d=document.register;  
      var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;  
      if(d.cn.value == '')  
      {  
           alert("Enter Name");  
           d.cn.focus();  
           return false;  
      }  
      if(d.cn.value.length<=2)  
      {  
      alert("Minimum Name Should be greater than two");  
      return false;       
      }  
      if(d.email.value == '')  
      {  
      alert("Email is is Required");  
      d.email.focus();  
      return false;       
      }  
      if(reg.test(d.email.value) == false)  
      {  
      alert("Invalid Email");  
      return false;       
      }  
      if(d.password.value == '')  
      {  
      alert("Password is is Required");  
      d.password.focus();  
      return false;       
      }  
      if(d.password.value != d.cpassword.value)  
      {  
      alert("Passwords Mismatch")  
      return false;       
      }  
      if(d.year.value == 1)  
      {  
      alert("Select Year");  
      return false;       
      }  
      if(d.gender[0].checked == false && d.gender[1].checked == false)  
      {  
      alert("Select Gender");  
      return false;       
      }  
      if(d.terms.checked == false)  
      {  
      alert("Accept terms");  
      return false;       
      }  
 }  
 </script>  
 <form name="register" method="post" onSubmit="return validate()">  
 <table width="200" border="1" align="center">  
  <tr>  
   <td>CompanyName<span style="color:red">*</span>:</td>  
   <td><input type="text" name="cn" id="cn"></td>  
  </tr>  
  <tr>  
   <td>Email<span style="color:red">*</span>:</td>  
   <td><input type="text" name="email" id="email"></td>  
  </tr>  
  <tr>  
   <td>Password<span style="color:red">*</span>:</td>  
   <td><input type="password" name="password" id="password"></td>  
  </tr>  
  <tr>  
   <td>Confirm-Password:</td>  
   <td><input type="password" name="cpassword" id="cpassword"></td>  
  </tr>  
  <tr>  
   <td>Year<span style="color:red">*</span>:</td>  
   <td>  
   <select name="year" id="year">  
   <option value="1">Select</option>  
   <?php for($i=1999;$i<=date(Y);$i++) { ?>  
   <option value="<?php echo $i ?>"><?php echo $i ?></option>  
   <?Php } ?>  
   </select>  
   </td>  
  </tr>  
  <tr>  
   <td>Gender<span style="color:red">*</span>:</td>  
   <td><input type="radio" name="gender" id="gender">Male  
   <input type="radio" name="gender" id="gender">FeMale</td>  
  </tr>  
  <tr>  
  <td colspan="2"><input type="checkbox" name="terms" id="terms">  
  I Accepted the <a href="terms.php">terms&conditions</a></td>  
  </tr>  
  <tr>  
   <td colspan="2" align="center"><input type="submit" name="submit" id="submit" value="Register"></td>  
  </tr>  
 </table>  
 </form>  

08:10 Share:

how to use ckeditor in php

Posted by D. arunkumar  |  No comments


03:55 Share:
Get updates in your email box
Complete the form below, and we'll send you the best coupons.

Deliver via FeedBurner
Proudly Powered by Blogger.
back to top