How to use PHPExcel library (Published in tisuchi.com)

There is no doubt that, PHP Excel Library is a super doper library for mastering on Excel document by PHP language. Personally I prefer to use PHP excel library to manipulate data with excel. Let’s take a look how can we use that sublime library in PHP.

Download PHP Excel Library

Go to following links for downloading. You may choose any source to download.

Although they have different download options, but I prefer to download from official page. After downloading successfully, extract downloaded zip folder. Now go inside extracted folder and sure enough you will get Classes folder. Now copy everything from classes folder and past in yourdesire folder (normally it is in your localhost). For example, I am using xampp in C drive and created a new folder called php in htdocs. So my url should be c://xampp/htdocs/php/. It can be different in your pc. Now time to browse your your file (PHPExcel.php). Based on my directory, my url should be like follows- http://localhost/php/PHPExcel.php. And sure enough that you will not get anything in browser.

 

 

To read more visit 

How to use PHPExcel library

Create HTML form with PHP Class ( Reposted from tisuchi.com)

This section would be very simple task for OOP with PHP developer. Although it could be very good foundation for beginner of Object Oriented Programming in PHP. In this tutorial, I am going to explain how to create HTML form by using PHP class. Its a very straight forward class that will generate few HTML form elements by calling particular function. Let’s see…

 Download from Github Demo

For implementing this tutorial, I am using 2 separate files of PHP. One is specifically dedicated for declaring class and another is representing the object of that class. There is nothing fancy in this tutorial. Its a very clean HTML form example.

To know more, visit 

Create HTML form with PHP Class

Using webcam with PHP language (Published on tisuchi.com)

This is a quite funny things that, using webcam with PHP language. I am pretty sure that, many of programmers are interested to integrated webcam with php script but don’t know how to do that. Well, it is not difficult to integrate. Let’s dig into php code that how easily we can do that.

One of my articles has been published on tisuchi.com tutorial site. If you are interested to know more, please visit following link.

http://tisuchi.com/using-webcam-with-php-language/

How to create form in Laravel 4

Laravel 4 form create

Form is a most expected elements in website as well as web based application. Each and every interactive web apps must have a form option to communicate between users and administrator. Whatever you want to write in website, there is not alternative about form. It could be in chat, message, as well as comments.

In laravel 4, you have huge flexibility to create HTML form easily. Today I will gonna to show you how to create a simple form in laravel. Let’s open route.php file to change our routing.

Route::get('/createform', function()
{
return View::make('createform');
});

Just change the view file name and write new file name that is ‘createform’. Save and close this file. Open apps/views directory and create a new file. File name should createform.blade.php that we defined in route.php file.

<?php

{{ Form::open() }}

{{ Form::label(‘name’, ‘Full Name: ‘) }}

{{ Form::text(‘name’) }}

{{ Form::label(’email’, ‘Email Address: ‘) }}

{{ Form::email(’email’) }}

{{ Form::label(‘password’, ‘Password: ‘) }}

{{ Form::password(‘password’) }}

{{ Form::submit(‘Save Data’) }}

{{ Form::close() }}

Now save your file and browse your site (http://localhost/createform). Hope you will get very simple form that will take name, email and password. Its not fancy but still work.

Continue reading

Understanding PHP Regular Expression

PHP is mostly used scripting language in web world. Regular expression of PHP is one of the most important key to handle the form validation. This tutorial, I am going to discuss about the PHP regular expression.

 

PHP Regular Expression tisuchi.wordpress.com

 

 

 

 

 

Fundamentally, there are few symbols to identify the users input. The list are follows with the explanation.

Symbol             Explanation

^                       Start of string
                      End of string
.                        Any single character
+                       One or more character
\                        Escape Special characters
?                       Zero or more characters

 

Look exact matching of code with “abc”.

$express = /^abc$/;

Look for starting letters with “abc….”.

$express = /^abc/;

Check letters end with “abc”.

$express = /abc$/;

Check the abc input with one single characters “abcs”

$express = /^abc.$/;

Check the abc text with more then one characters like abcsy

$express = /^abc.+$/;

Passed any characters like abcstuvw123…

$express = /^abc.+?$/;

Continue reading

POST input_filter() in PHP

Hello
Today I am going to show the details about the input_filter() function in PHP for POST method. In this case, we have to create 2 files entitled form.php and form_process.php files. So, let’s start the work-

form.php

<?php
echo showIt();
function showIt(){
$r = ”;
$r .= ‘<form method=”POST” action=”inputFilter.php”>’;
$r .= ‘<table>’;
$r .= ‘<tr><td>ID :</td><td><input type=”text” name=”id2″/> (must be between 3 and 10)</td></tr>’;
$r .= ‘<tr><td></td><td><input type=”submit” name=”submit” value=”POST”/></td></tr>’;
$r .= ‘</table>’;
$r .= ‘</form>’;
return $r;
}
?>

Now, I am going to write the code for form_process.php file. The code is below-

<?php
$id = filter_input(INPUT_POST, ‘id’, FILTER_VALIDATE_INT, array(‘options’=>array(‘min_range’=>3, ‘max_range’=>10)));
 
if(is_null($id)){
       echo “The ID arguments is missing”;
}elseif($id === false){
       echo “The ID argument must be an integar between 3 and 10”;
}else{
       echo “ID is valid : $id”;
}
?>

 

Ok, now run the file of form.php and write the code. Hope it’s ok now. Everything is going well. Isn’t it? Sound good.

Thanks for reading. Bye.

Set Cron Job in Cpanel by PHP


Tutorial Details
Subject : PHP
Duration : 15 Minuts
Level : Medium / Advanced level PHP Programmer
Language : Html & PHP


 

Hello Friends,
Lets go to learn how to set a cron job in cpanel by using PHP script. We are ready to write a simple PHP script for sending email to an email address in every 5 minutes by using creating cron job. First of all, we have to write a PHP email script. I am sending the code in below-

<?php

$to = ‘abc@abc.com’;
$sub = ‘Hello Cron Job!’;
$message = ‘This is for dummy Cron Job.’;
$from = “someonelse@example.com”;
$headers = “From:” . $from;

mail($to, $sub, $message, $headers);

?>

After writing this, I am saving this file named email.php. Now, lets go to our Cpanel. After then, go to public_html and create a new folder test.

Step 1: After successfully loing your Cpanel….

Step 2 : In Advanced tab, you will get the icon entitled Cron jobs. Click on this icon.

Step 3: In Add New Cron, fill up the form. First of all, choose a Common Settings. You can choose anything. Others fields, you can change or may not.

Step 4: Now go to the last field Command and write php /home/user_name123/public_html/test/cron.php for PHP. [In user_name123, you have to use cpanel user name]

Step 5: Now click Add a New Cron Job button.

Ok, you have completed all the work. Now, wait and see. Your script will be work according to your cron time.

Thanks for ready. Take Care. Bye