PHP Syllabus for Advance self training program

Introduction to OOPS

Declaring a Class
The new Keyword and Constructor
Access Methods and Properties Using $this keyword
Public, Protected and Private Properties and Methods
Static Properties and Methods
Class Constants
Inheritance and Code Re-Usability
Parent : and : Self :: keyword
Instance of operator
Abstract Methods and Class


CodeIgniter framework MVC
Using HMVC (Hierarchical Model View Controller)

PHP Syllabus for self training program

Intrroduction to PHP

Evaluation of PHP
Basic Syntax
Defining Variable and Constant
PHP Data Type
Operator and Expression

Handling HTML Forms with PHP

Capturing Form Data
Dealing with Multi Valued Field
Generating File Upload Form
Redirecting a Form after submission

Conditions and Loops

Making Decisions ( if- else)
For loops, While loops
For each loops
Embedding HTML With Conditions and Loops


Introduction to Functions in PHP
Define a Function
Call By Value Call by Reference
Recursive Functions


Creating and Accessing String
Searching and Replacing String
String Related Library Functions

Array in PHP

Structure of Array
Indexing and Associative Array
Accessing Array Elements
Looping Through array
Array Related Library Function

Server State Management

Using Query String
Using Hidden Fields
Using Cookies
Using Sessions

String Matching With Regular Expression

Introduction to Regular Expression
Pattern Matching Using Regular Expression
Replacing Text
Database Connectivity with MySql
Introduction to RDBMS

Connection With MySql Database

Performing Basic Operations (CRUD)
Setting Query Parameter
Executing Query
((Mini Project Authentication System))

How to Upload File in PHP

File upload is a most used feature in the web application. PHP provides an easy way to upload file to the server. With PHP, you can upload file or images to the server by writing minimal code. In this tutorial, we’ll provide a PHP script to upload file to the directory on the server. Using our PHP file upload script you can upload all types of files including images to the server in PHP.

Upload Form HTML

At first, an HTML form needs to be created that allow users to choose a file they want to upload.
Make sure <input> tag contains the following attributes.

  • method=”post”
  • enctype=”multipart/form-data”

Also, make sure <input> tag contains type="file" attribute.

<form action="upload.php" method="post" enctype="multipart/form-data">
    Select File to Upload:
    <input type="file" name="file">
    <input type="submit" name="submit" value="Upload">

The above file upload form will be submitted to the upload.php file for uploading file to the server.

Upload File in PHP (upload.php)

PHP provides a function called move_uploaded_file() that moves an uploaded file to a new location. Using move_uploaded_file() function we can upload a file in PHP.
The following code is used to upload file in PHP. Specify the directory in $targetDir variable, where the uploaded file will be placed. Also, define the file types that you want to allow for uploading.

$statusMsg = '';
//file upload path
$targetDir = "uploads/";
$fileName = basename($_FILES["file"]["name"]);
$targetFilePath = $targetDir . $fileName;
$fileType = pathinfo($targetFilePath,PATHINFO_EXTENSION);
if(isset($_POST["submit"]) && !empty($_FILES["file"]["name"])) {
    //allow certain file formats
    $allowTypes = array('jpg','png','jpeg','gif','pdf');
    if(in_array($fileType, $allowTypes)){
        //upload file to server
        if(move_uploaded_file($_FILES["file"]["tmp_name"], $targetFilePath)){
            $statusMsg = "The file ".$fileName. " has been uploaded.";
            $statusMsg = "Sorry, there was an error uploading your file.";
        $statusMsg = 'Sorry, only JPG, JPEG, PNG, GIF, & PDF files are allowed to upload.';
    $statusMsg = 'Please select a file to upload.';
//display status message
echo $statusMsg;