Monday, 16 November 2015

Convert HTML to PDF using php

Convert HTML to PDF using php



  1. First of all we need the supporting file so please download TCPDF
  2. Just create pdf.php file and copy the below code.
  3. The supporting file locate as the same folder or you just modify the link in above code as require_once(dirname(__FILE__).'/tcpdf/tcpdf.php');.


 <?php   
 $url=parse_url($_SERVER['HTTP_REFERER']);  
 // Include the main TCPDF library (search for installation path).  
 require_once(dirname(__FILE__).'/tcpdf/tcpdf.php');  
 // create new PDF document  
 $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);  
 // set document information  
 $pdf->SetCreator(PDF_CREATOR);  
 $pdf->SetAuthor('Sakthivel');  
 $pdf->SetTitle('talentcoders.blogspot.com Download pdf');  
 $pdf->SetSubject('Downloadable pdf');  
 $pdf->SetKeywords('PDF for invoice');  
 // set default header data  
 /*$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 001', PDF_HEADER_STRING, array(0,64,255), array(0,64,128));*/  
 /*$pdf->setFooterData(array(0,64,0), array(0,64,128));*/  
 // set header and footer fonts  

Wednesday, 4 November 2015

Upload the image using AJAX

How to upload the image using AJAX

Step 1 : First of all need to download the plugin from the following link. Plugins
Step 2 : Then create the front end design to copy the below code.
 <link href="<?php echo asset_path ?>plugins/ajax_upload/assets/css/style.css" rel="stylesheet" />  
 <form class="form-horizontal" id="upload" method="post" action="<?php echo admin_path; ?>add_post/upload" enctype="multipart/form-data">  
 <input type="hidden" name="<?php echo $this->security->get_csrf_token_name(); ?>" id="csrf_token" value="<?php echo $this->security->get_csrf_hash(); ?>" />  
 <div class="form-group mar_top20">  
   <label for="" class="col-sm-3 control-label">Cover Image</label>  
   <div class="col-sm-7">  
    <div class="cover">  
         <div class="drop">  
                     <a>Browse</a>  
                     <input type="file" name="upl" />  
                </div>  
                <ul>  
                </ul>  
                </div>  
   </div>  
   </div>   
    </form>  
    <link href="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/css/select2.min.css" rel="stylesheet" />  
   <link href="<?php echo asset_path ?>plugins/datepicker/datepicker3.css" rel="stylesheet" />  
 <script src="//cdnjs.cloudflare.com/ajax/libs/s

Saturday, 24 October 2015

Send mail with attachment using PHP-Mailer Function

How to send mail with attachment using PHP-Mailer Function

Step 1 : Just the copy and paste the below code on mail.php and use it.
Just download Php-Mailer Function
 <?php  
 include('base.php');  
 $home=new main();  
 require_once('plugin/PHPMailer-master/class.phpmailer.php');  
 if(isset($_POST['submit']))  
 {       
      $fname=$_POST['fname'];  
      $phno=$_POST['phno'];  
      $email=$_POST['email'];  
      $college=$_POST['college'];  
           $path="SACMS/resume/";  
                $valid_formats = array("doc", "docx", "pdf");  
                $name = $_FILES['resume']['name'];  
                $size = $_FILES['resume']['size'];  
                if(strlen($name))  

Friday, 9 October 2015

Send email with attachment using Codeigniter

How to send email with attachment using Codeigniter

Step 1 : we want to create the front end on view folder. just copy and paste the below code.


 <form action="<?php echo site_path?>career/mail_resume" enctype="multipart/form-data" method="POST" class="col s12">  
   <input type="hidden" name="<?php echo $this->security->get_csrf_token_name(); ?>" value="<?php echo $this->security->get_csrf_hash();?>" />  
    <div class="row">  
     <div class="input-field col s6">  
      <input id="first_name" type="text" name="fname" class="validate">  
      <label for="first_name">First Name</label>  
     </div>  
     <div class="input-field col s6">  
      <input id="last_name" type="text" name="lname" class="validate">  
      <label for="last_name">Last Name</label>  
     </div>  
    </div>  
    <div class="row">  
     <div class="input-field col s6">  
      <input id="icon_telephone" type="tel" name="mob" class="validate">  
      <label for="icon_telephone">Mobile</label>  
     </div>  
     <div class="input-field col s6">  
      <input id="email" type="email" name="email" class="validate">  
      <label for="email">Email</label>  
      </div>  
    </div>  

Thursday, 8 October 2015

Show Countries, States, Cities, on Dropdown box using JQuery

How to show Countries, States, Cities, on Dropdown box using JQuery

The Given Code for auto load Countries, State and Cities using JQuery


 <select class="countries" id="countryId" name="country">  
   <option value="">Select Country</option>  
 </select>  
 <select class="states" id="stateId" name="state">  
    <option value="">Select State</option>  
 </select>  
 <select class="cities" id="cityId" name="city">  
   <option value="">Select City</option>  
 </select>  

Wednesday, 7 October 2015

Check the IP Address of visitors using PHP

How to check the IP Address of visitors using PHP

Just copy the below code.

 function getRealIpAddr()  
      {  
           if (!empty($_SERVER['HTTP_CLIENT_IP']))  //check ip from share internet  
           {  
            $ip=$_SERVER['HTTP_CLIENT_IP'];  
           }  
           elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))  //to check ip is pass from proxy  
           {  
            $ip=$_SERVER['HTTP_X_FORWARDED_FOR'];  
           }  
           else  
           {  
            $ip=$_SERVER['REMOTE_ADDR'];  
           }  
           return $ip;  
      }  
IP Tracker

Tuesday, 6 October 2015

Add the checkbox value cart using Jquery

How to add the checkbox value cart using Jquery

Step 1 : First we will create the html file with the check box
 <div class="bfmenu">  
 <h3>Breakfast</h3>  
 <h4>SWEETS</h4>  
 <div id="widspc">  
 <div class="squaredOne">  
 <input type="checkbox" value="Kesari" id="item1_1" name="check1[]" />  
 <label for="item1_1"><h5 class="txt">Kesari</h5></label>  
 </div><!--/.squaredOne-->  
 </div><!--/.widspc-->                                                             
 <div id="widspc">                             
 <div class="squaredOne">  
 <input type="checkbox" value="Pineapple Kesari" id="item2_1" name="check1[]" />  
 <label for="item2_1"><h5 class="txt">Pineapple Kesari</h5></label>  
 </div><!--/.squaredOne-->  
 </div><!--/.widspc-->  

Thursday, 1 October 2015

Send SMS for subscriber using PHP

How to send SMS for subscriber using PHP

We need to get the message provider link then copy the below code.
 $host=$_SERVER['SERVER_NAME'];  
      $admin='info@'.$host;  
      $username= urlencode('username');//username  
      $password= urlencode('password');//pasword  
      $admin_phone=urlencode('mob.no');//mobile number  
      date_default_timezone_set("Asia/Kolkata");  
      $msg_provider='your message provider url';  
      $name=mysql_escape_string($_POST['name']);  
 $email=mysql_escape_string($_POST['email']);  
      $message=mysql_escape_string($_POST['message']);  
 $phone_message="Enquiry From : ".$name."\nPhone No : ".$phno."\nMessage : ".$message;  
           $msg1=urlencode($phone_message);  
           $msg_url = $msg_provider.'?user='.$username.'&pass='.$password.'&sender=BYPORT&phone='.$admin_phone.'&text='.$msg1.'&priority=ndnd&stype=normal';  
           $ch = curl_init($msg_url);  
           curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);  
           $curl_scraped_page = curl_exec($ch);  
           curl_close($ch);  

Wednesday, 30 September 2015

Create the Google Map Using Jquery

How to create the Google Map Using Jquery

We need to create the script for the google map.
Script Given Below.
 <head>  
 <script  
 src="http://maps.googleapis.com/maps/api/js">  
 </script>  
 <script>  
 var myCenter=new google.maps.LatLng(11.508742,77.120850);  
 function initialize()  
 {  
 var mapProp = {  
  center:myCenter,  
  zoom:5,  
  mapTypeId:google.maps.MapTypeId.ROADMAP  

Tuesday, 29 September 2015

Use Border Radius on Internet Explorer

How to use Border Radius on Internet Explorer

Step 1 : Need PIE.HTC file download from the given link.Pie.htc

Use the below css code for call the .htc file

 #someSelector {  
 behavior: url('/path/to/file/css3pie.htc');  
 // Normal properties here...  
 }  


Monday, 28 September 2015

Destroy cookies and unset the user data using Codeigniter

How to Destroy cookies and unset the user data using Codeigniter

Step 1 : We create signout.php on view folder and copy the below code.

 <?php  
 redirect(site_path.'login','refresh');  
 ?>  

Create the signout.php on controller folder and copy the below code.

 function __construct()  
      {  
           parent::__construct();  
           $this->load->helper('url');  
           $this->load->library('session');  
           if(!isset($this->session->unset_userdata['userid']))  
           {  
                $this->session->sess_destroy();  
                redirect(site_path.'login','refresh');  

Friday, 25 September 2015

Add data to database using simple AJAX

How to Add data to database using simple AJAX

Step 1 : First we will create the form with username and details fields.
Step 2 : Then create ajax code with in same page.
 <script>  
 $(document).ready(function(){  
 $('#ajax-contact-form').submit(function(evt){  
           evt.preventDefault();  
           $.ajax({  
 type: "POST",  
 /*dataType: "json",*/  
 url: "add.php",  
 data: $('#ajax-contact-form').serialize(),  
 success: function(html){  
      if(html==1)  
      {  
           alert("Added successfully");  
           window.location="index.php";  

Thursday, 24 September 2015

Fix the sidebar within a particular space using Jquery

How to Fix the sidebar within a particular space using Jquery

First we create div and give id for div the use the below jquery code.
<script type="text/javascript">  
        $(document).ready(function(){  
             var winheight=$(window).height();  
             var docheight=$(document).height();  
             var footheight=$('#bottom').height();  
             var divheight=$('#fix').height();  
             var vheight=$('#fix').offset().top;  
             //alert(winheight + '--'+docheight +'--'+ footheight);  
             var finalhe=docheight-footheight-divheight-vheight+80;  
             $(window).scroll(function(){  
             if($(this).scrollTop() > 300 && $(this).scrollTop() < finalhe)  
             {  
                  //alert($(this).scrollTop()+'--'+finalhe);  
                     $('#fix').css('position','fixed');  
                     $('#fix').css('top','20px');  
                     $('#fix').css('width','253');  
                     $('#fix ul .full .parent_li .sub-menu').css('z-index','11');  
                }  
                else  
                {  
                     $('#fix').css('position','relative');  
                     $('#fix').css('width','253');  
                     $('#fix').css('top','0px');  
                }  
                });  
        });  
   </script>  
Example screenshot.

Wednesday, 23 September 2015

Update the data with images to database using Codeigniter

How to update the data with images to database using Codeigniter

Step 1 : In view folder create edit_project.php file and copy the following data.
 <form action="<?php echo site_path?>admin/edit_update/<?php echo $edit1['list_id'];?>" method="post" enctype="multipart/form-data">  
         <input type="hidden" name="<?php echo $this->security->get_csrf_token_name(); ?>" id="csrf_token" value="<?php echo $this->security->get_csrf_hash(); ?>"/>  
           <div class="row">  
                <div class="col-lg-12">  
                     <div class="col-lg-2"><label for="text">Title</label></div>  
                     <input type="text" class="text" id="title" name="title" placeholder="Title" value="<?php echo $edit1['title'];?>"/>  
                </div>  
           </div>  
           <div class="row">  
                <div class="col-lg-12">  
                     <div class="col-lg-2"><label for="text">Category</label></div>  
                     <!--<input type="text" class="text" id="categoty" name="category" placeholder="Category" value="<?php echo $edit1['category'];?>"/>-->  
                     <select class="col-lg-3 " multiple="multiple" id="categoty" name="category[]" style="margin-bottom: 10px;">  
                     <?php   
                     foreach($cate as $opt)  
                     {  

Create Secure Login with Session Login in using Codeigniter

How to create Secure Login with Session Login in using Codeigniter

Step 1 : In view folder create login page and copy the below code.
 <div class="form-box" id="login-box">  
       <div class="header">Sign In</div>  
       <form action="" method="post" id="frm">  
       <input type="hidden" name="<?php echo $this->security->get_csrf_token_name(); ?>" id="csrf_token" value="<?php echo $this->security->get_csrf_hash(); ?>"/>  
         <div class="body bg-gray">  
         <?php if($message!='')  
                     {  
                          ?>  
                          <div class="alert alert-danger alert-dismissable" id="alert">  
                     <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>  
                     <b>Alert!</b> Username or Password not match  
                   </div>  
                          <?php   
                     }?>  
           <div class="form-group">  
             <input type="text" name="userid" class="form-control" id="name" placeholder="User ID" value="<?php echo $username;?>"/>  
           </div>  
           <div class="form-group">  
             <input type="password" name="password" class="form-control" id="email" placeholder="Password"/>  
           </div>       
         </div>  
         <div class="footer">             

Tuesday, 22 September 2015

Form Validation using Codigniter

How to Form Validation using Codigniter

Step 1 : just copy and paste the below content.
 $this->load->library('form_validation');  
           if ($this->form_validation->run('add_project') == FALSE)  
           {  
             echo validation_errors();  
           }  
           else  
           {  

Step 2 : Create form_validation.php on config folder and copy the below content.

Saturday, 19 September 2015

Ordering table list on database using Codeigniter

How to ordering table list on database using Codeigniter

Step 1 : First create order table in database.

step 2 : In model folder just copy and paste the below code.
 public function view_order()  
      {  
           $this->db->select('*');  
           $this->db->from('list');  
           $this->db->where('removed','0');  
           return $this->db->count_all_results();  
      }  

Step 3 : you just copy and paste the code on controller folder at any page.

Insert data with image to Database using Codeigniter

How to Insert data with image to Database using Codeigniter

First of all we will create form on PHP page That placed in View Folder
 <form method="post" action="<?php echo site_path?>add/add_project" enctype="multipart/form-data" class="form col-lg-12 col-md-12 col-sm-12 col-sx-12">  
                                    <input type="hidden" name="<?php echo $this->security->get_csrf_token_name(); ?>" id="csrf_token" value="<?php echo $this->security->get_csrf_hash(); ?>"/>  
                                         <div class="col-lg-12">  
                                              <div class="col-lg-2 text-left lable"><label for="title">Title</label></div>  
                                              <input type="text" placeholder="Name" class="text col-lg-6" name="title" id="title"/>  
                                              </div>  
                                              <div class="col-lg-12">  
                                              <div class="col-lg-2 text-left lable"><label for="title">Descrption</label></div>  
                                              <textarea placeholder="Description" class="text col-lg-6" rows="6" name="desc" id="title"></textarea>  
                                              </div>  
                                              <div class="col-lg-12">  
                                              <div class="col-lg-2 text-left lable"><label for="image">Image</label></div>  
                                              <input type="file" placeholder="Image" name="image" class="col-lg-6 text"/>  
                                              </div>  
                                              <div class="col-lg-6 pull-right">  
                                              <input type="submit" placeholder="Image" class="submit col-lg-5 pull-left" value="Submit"/>  
                                              </div>  
                                              <div class="col-lg-6 pull-right">  

Friday, 18 September 2015

Fix the Menubar using Jquery

How to Fix the Menubar using Jquery

 <script type="text/javascript">  
 $(document).ready(function(){  
  var nav = $('.hemo');  
  var nav1 = $('.hemo1');  
  var logo = $('.logo');  
  var logo1 = $('.logo1');  
      $(window).scroll(function () {  
           if ($(this).scrollTop() > 200) {  
                $('.fixed').css('position','fixed');  
                $('.fixed').css('top','50px');  
           } else {  
                $('.fixed').css('position','relative');  
           $('.fixed').css('top','0px');  
           }  
      });  
      });  
 </script>  

Menu Bar

Translate effect for box using CSS

How to give Translate effect for box using CSS

 .box {  
  transform: translate(20px, 10px);  
 }  

 transform: translateX(value);  
 transform: translateY(value);  

Values

translate(): moves an element sideways or up and down.

Rotate the box in css

How to Rotate the box in css

 .box {  
  transform: rotate(25deg);  
 }  

Values


rotate(): rotates the element clockwise from its current position.

Make the design with Skew in CSS

How to make the design with Skew in CSS

 .element {  
  transform: skewX(25deg);  
 }  
 .element {  
  transform: skewY(25deg);  
 }  

Values

skewX() and skewY(): tilts an element to the left or right, like turning a triangle into a parallelogram. There is no shorthand skew property.

Use scale in CSS

How to use scale in CSS

 .element {  
  transform: scale(1, 1.5);  
 }  

 transform: scaleX(2);  
 transform: scaleY(.5);  

Values


scale(): affects the size of the element. This also applies to the font-size, padding, height, and width of an element, too. It’s also a a shorthand function for the scaleX and scaleY functions.

Thursday, 17 September 2015

Set footer put down on the page

How to set footer put down on the page

 

Wednesday, 16 September 2015

Validate form in Validate.JS

How to validate form in Validate.JS

Just download the following link.

 http://ajax.aspnetcdn.com/ajax/jquery.validate/1.14.0/jquery.validate.js  

Add following code for particular form.


 <script>  
 $(document).ready(function(){  

Login with database using MYSQL-I

How to login with database using MYSQL-I

 <?php   
 $conn1=new MySQLi("localhost","root","","mysqli");  
 if(isset($_POST['btnsubmit']))  
 {  
      if(empty($_POST['txtname']))  
      {  
           $message="Invalid user name";  
      }  
      elseif(strlen($_POST['txtpass'])<8 || empty($_POST['txtpass']))  
      {  
           $message="Invalid password";  
      }  
      else  
      {  

Connect database Using PDO

How to connect database Using PDO

 function __construct()  
      {  
           try  
           {  
                $serverName="localhost";  
                $this->db = new PDO('mysql:host=localhost;dbname=xxx', "db_username", "db_password");  
                $this->db->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );  
           }  
           catch(Exception $e)  
           {  
                die( print_r( $e->getMessage() ) );   
           }  
      }  

Tuesday, 15 September 2015

Insert row Using MYSQL-I

How to insert row Using MYSQL-I

 <?php  
 //values to be inserted in database table  
 $product_code = '"'.$mysqli->real_escape_string('P1234').'"';  
 $product_name = '"'.$mysqli->real_escape_string('42 inch TV').'"';  
 $product_price = '"'.$mysqli->real_escape_string('600').'"';  
 //MySqli Insert Query  
 $insert_row = $mysqli->query("INSERT INTO products (product_code, product_name, price) VALUES($product_code, $product_name, $product_price)");  
 if($insert_row){  
   print 'Success! ID of last inserted record is : ' .$mysqli->insert_id .'<br />';   
 }else{  
   die('Error : ('. $mysqli->errno .') '. $mysqli->error);  
 }  
 ?>  

Make Mail function in PHP

This summary is not available. Please click here to view the post.