html body { margin-top: 50px !important; } #top_form { position: fixed; top:0; left:0; width: 100%; margin:0; z-index: 2100000000; -moz-user-select: none; -khtml-user-select: none; -webkit-user-select: none; -o-user-select: none; border-bottom:1px solid #151515; background:#FFC8C8; height:45px; line-height:45px; } #top_form input[name=url] { width: 550px; height: 20px; padding: 5px; font: 13px "Helvetica Neue",Helvetica,Arial,sans-serif; border: 0px none; background: none repeat scroll 0% 0% #FFF; }
,

, and

and provides a simple example of an HTML page structure. It also describes what HTML elements and attributes are, giving examples of common attributes like href and src.">

0% found this document useful (0 votes)
107 views49 pages

Training File

The document provides an introduction to HTML. It defines HTML as the standard markup language used to define the structure of web pages. It explains some of the core HTML elements like <html>, <head>, <body>, <h1>, and <p> and provides a simple example of an HTML page structure. It also describes what HTML elements and attributes are, giving examples of common attributes like href and src.

Uploaded by

Jaskirat Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
107 views49 pages

Training File

The document provides an introduction to HTML. It defines HTML as the standard markup language used to define the structure of web pages. It explains some of the core HTML elements like <html>, <head>, <body>, <h1>, and <p> and provides a simple example of an HTML page structure. It also describes what HTML elements and attributes are, giving examples of common attributes like href and src.

Uploaded by

Jaskirat Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 49

TRAINING REPORT

On
Zamindar Kesar Mehal
Submitted to GIANI ZAIL SINGH CAMPUS COLLEGE OF ENGINEERING AND
TECHNOLOGY in partial fulfillment of the requirement for the award of the
degree of
B.TECH
In
COMPUTER SCIENCE & ENGINEERING
Submitted By
Deepak Rout (190280034)
Paras Mishra (190280150)

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING

GIANI ZAIL SINGH CAMPUS COLLEGE OF ENGINEERING &


TECHNOLOGY, MAHARAJA RANJIT SINGH PUNJAB TECHNICAL
UNIVERSITY, BATHINDA-151001

1
TRAINING REPORT

On

Zamindar Kesar Mehal


Submitted to GIANI ZAIL SINGH CAMPUS COLLEGE OF ENGINEERING AND
TECHNOLOGY in partial fulfillment of the requirement for the award of the
degree of
B.TECH
In
COMPUTER SCIENCE & ENGINEERING
Submitted By
Deepak Rout(190280034)
Paras Mishra(190280150)

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING

GIANI ZAIL SINGH CAMPUS COLLEGE OF ENGINEERING &


TECHNOLOGY, MAHARAJA RANJIT SINGH PUNJAB TECHNICAL
UNIVERSITY, BATHINDA-151001

2
3
4
PREFACE
Project is an integral part of B.Tech and each and every student has to undergo the
report for in a institute.

This record is concerned about our practical training during the 7th semester of our
B.Tech. I have taken my Practical Training in web development .During this
training, We got to learn many new things about web development and the current
requirements of companies. This project proved to be a milestone in our
knowledge of present industry. Every say and every moment was an experience in
itself, an experience which theoretical study can’t provide.

5
ACKNOWLEDGEMENT
It is my pleasure to be indebted to various people, who directly or indirectly contributed in the
development of this work and who influenced my thinking, behavior and acts during the course
of study.

I express my sincere gratitude to Er. Jyoti Rani worthy HOD and Er.Manpreet , Department
Training & Placement In-charge for providing me an opportunity to undergo summer training at
Inert IT Pvt Ltd

I am thankful to Adhitya Gupta sir for his support, cooperation, and motivation provided to me
during the training for constant inspiration, presence and blessings.

I also extend my sincere appreciation to all my friends who provided his valuable suggestions
and precious time in accomplishing my training report.

Lastly, I would like to thank the almighty and my parents for their moral support and my friends
with whom I shared my day-to-day experience and received lots of suggestions that my quality
of work.

DEEPAK ROUT
PARAS MISHRA

6
DECLARATION

I, PARAS MISHRA AND DEEPAK ROUT, Roll No. 190280150, 190280034 respectively,
B.Tech (Semester- VII) of the Gaini Zail Singh Campus College of Engineering &
Technology, Bathinda hereby declare that the Training Report entitled “Zamindar Kesar
Mehal” is an original work and data provided in the study is authentic to the best of my
knowledge. This report has not been submitted to any other Institute for the award of any other
degree.

DEEPAK ROUT PARAS MISHRA


(190280063) (1902800100)

This is certify that the above statement made by the candidate is correct to the best of my
knowledge.They are permitted to appear in the External Project Examination

Er. MANPREET MAM Signature of Internal Examiner


Prof,CSE

Name Signature of External Examiner

7
ABSTRACT

ZAMINDAR KESAR MEHAL is mainly for dryfruits and Kashmiri masalas.We


provide 100% pure Safforn and other dryfruits. We provide all different types of
dryfruits with good quality. In this website all the products related to dryfruits are best in
quality and have reasonable price.We serve the quality not the quantity.

8
CONTENTS

1. WEB DEVELOPMENT INTRODUCTION 8-8

2. INTRODUCTION TO HTML 9-16

3. INTODUCTION TO CSS 16-21

4. INTRODUCTION TO BOOTSTRAP 21-23

5. INTRODUCTION TO JAVASCRIPT 23-26

6. INTRODUCTION TO PHP 27-34

7. WEB DEVELOPMENT PROJECT 34- 35

8. RESULT AND DISCUSSION 35-36

9. CONCLUSION AND SCOPE 37-38

9
CHAPTER 1:Introduction to Web development

1.1.1 What is web development?


Web development is the work involved in developing a website for the Internet (World Wide Web) or
an intranet (a private network). Web development can range from developing a simple single static
page of plain text to complex web applications, electronic businesses, and social network services. A
more comprehensive list of tasks to which Web development commonly refers, may include Web
engineering, Web design, Web content development, client liaison, client-side/server-side
scripting, Web server and network security configuration, and e-commerce development.

1.1.2 Who is Web Developer


A web developer is at heart an interactive artist. They’re someone driven by a deep desire to
creat things. A web developer’s canvas is a user’s web browser.

Much like how a curious child takes


pleasure in making toys by joining LEGO blocks—and then experiences a similar joy in taking things
apart to see how they’re made, a web developer’s job is to use the basic building blocks of the web
(like HTML, CSS and JavaScript) to create something complex like a webpage. Don’t sweat it! We’ll
get into all of those terms soon.

1.2.1 Types of web developers

There are different types of web developers who focus on different areas. These include:

• Frontend developers: Frontend developers implement web page designs using HTML and
CSS. They make sure the website looks pretty on different devices, and that the forms and
buttons work.
• Backend developers: Backend developers create the backbone of the web application. They
write code logic that handles a user’s input (for example, what should happen when you click
the signup button after filling in a form).
• Full stack developers: Full stack developers do bits of both backend and frontend. Depending
on the problem at hand, they can switch cape 🦸♀️🦸♂️ and move stacks.

10
CHAPTER 2:- INDRODUCTION TO HTML

2.1.1 : WHAT IS HTML

• HTML stands for Hyper Text Markup Language


• HTML is the standard markup language for creating Web pages
• HTML describes the structure of a Web page
• HTML consists of a series of elements
• HTML elements tell the browser how to display the content
• HTML elements label pieces of content such as "this is a heading", "this is a
paragraph", "this is a link", etc.

2.1.2 : A Simple HTML Example


<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>

<h1>My First Heading</h1>


<p>My first paragraph.</p>

</body>
</html>

2.1.3 : A Simple HTML Example Explained

• The <!DOCTYPE html> declaration defines that this document is an HTML5


document
• The <html> element is the root element of an HTML page
• The <head> element contains meta information about the HTML page

11
• The <title> element specifies a title for the HTML page (which is shown in the
browser's title bar or in the page's tab)
• The <body> element defines the document's body, and is a container for all the visible
contents, such as headings, paragraphs, images, hyperlinks, tables, lists, etc.
• The <h1> element defines a large heading
• The <p> element defines a paragraph

2.1.4 : What is HTML Elements


An HTML element is defined by a start tag,some content,and an end tag;

<tagname>Content goes here…</tagname>

The HTML element is everything form start tag to the end tag:

<h1> My First Heading</h1>

<p>My first paragraph.</p>

2.2.1: HTML ATTRIBUTES


• All HTML elements can have attributes

• Attributes provide additional information about elements

• Attributes are always specified in the start tag

• Attribues usually come in name/value pairs like:name=” value”

# The href Attribute

The <a>tag defines a hyperlink.the href attributes specifies the URL of the page

The link goes like:Example:<a href=” google.com”>google</a>

# The src Attribute

The <img> tag is used to embed an image in an HTML page. The src attribute specifies the path
to the image to be displayed:

12
Example:

<img src="food.jpg">

# The width and height Attributes

The <img> tag should also contain the width and height attributes, which specifies the width and height of the
image (in pixels):

Example:

<img src="food.jpg" width="500" height="600">

# The alt Attribute

The required alt attribute for the <img> tag specifies an alternate text for an image, if the image for
some reason cannot be displayed. This can be due to slow connection, or an error in the src attribute, or
if the user uses a screen reader.

Example

<img src="food.jpg" alt="Burger">

2.3.1: HTML Headings


HTML headings are titles or subtitles that you want to display on a webpage.

HTML headings are defined with the <h1> to <h6> tags. <h1> defines the most important
heading. <h6> defines the least important heading.

Example:

Input: <h1>Heading 1</h1>


<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>

Output:

Heading 1
13
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6

2.4.1:HTML Paragraph
The HTML <p> element defines a paragraph.

A paragraph always starts on a new line, and browsers automatically add some white space (a margin)
before and after a paragraph.

Example:

<p>This is a paragraph.</p> //This ia a paragraph


<p>This is another paragraph.</p> //This is a another paragraph

2.5.1: HTML Horizontal Rule

The <hr> tag defines a thematic break in an HTML page, and is most often displayed as a horizontal
rule. The <hr> element is used to separate content (or define a change) in an HTML page:

Example:

<h1>This is heading 1</h1>

<p>This is some text.</p>

<hr>

<h2>This is heading 2</h2>

<p>This is some other text.</p>

<hr>

2.6.1: HTML Line Breaks

The HTML <br> element defines a line break.

Use <br> if you want a line break (a new line) without starting a new paragraph:
14
Example:

<p>This is<br>a paragraph with line breaks.</p>

Output: This is

a paragraph with line break.

2.7.1:HTML Styles

The HTML style attribute is used to add styles to an element, such as color, font, size, and more.

Example:

I am Red
I am Blue

I am Big
Syntax: <tagname style="property:value;">

# HTML Fonts
The CSS font-family property defines the font to be used for an HTML element:
Example:
<h1 style="font-family:Algerian;">This is a heading</h1>

Output: This is a heading

# HTML Colour
The CSS color property defines the text color for an HTML element:
Example:
<h1 style="color:blue;">This is a heading</h1>
<p style="color:red;">This is a paragraph.</p>
Output:

This is a heading
This is a heading

15
# HTML Size
The CSS font-size property defines the text size for an HTML element:
Example:
<h1 style="font-size:160%;">This is a heading</h1>

Output: This is heading


2.8.1: HTML Comments
With comments you can place notifications and reminders in your HTML code:
Example:
<!-- This is a comment -->

<p>This is a paragraph.</p>

<!-- Remember to add more information here -->

2.9.1: HTML links-Hyperlinks

HTML links are hyperlinks. You can click on a link and jump to another document.

When you move the mouse over a link, the mouse arrow will turn into a little hand.

Syntax: <a href="url">link text</a>

Example:

<a href="https://www.google.com/">Visit google</a>

2.10.1: HTML Images

Images can improve the design and the appearance of a web page.

Syntax: <img src="Image address" alt="Alternate name">

Example:

<img src="pic_trulli.jpg" alt="Italian Trulli">

2.11.1: HTML Lists

16
HTML lists allow web developers to group a set of related items in lists.

Example:

An unordered HTML list: An ordered HTML lists

• Item 1.Item
• Item 2.Item
• Item 3.Item
• Item 4.Item

2.11.2: HTML Discription List

HTML Description list is also a list style which is supported by HTML and XHTML. It is also known
as definition list where entries are listed like a dictionary or encyclopedia.

1. <dl> tag defines the start of the list.


2. <dt> tag defines a term.
3. <dd> tag defines the term definition (description).

Example:

<dl>

<dt>Coffee</dt>

<dd> -black hot drink</dd>

</dl>

2.12: HTML Classes

The HTML class attribute is used to specify a class for an HTML element.

Multiple HTML elements can share the same class.

Example:

17
<h class=”headd ”>this is heading</h>

<h class=”headd ”>this is 2nd heading</h>

2.13:HTML ids

The HTML id attribute is used to specify a unique id for an HTML element.

You cannot have more than one element with the same id in an HTML document.

Example:

<h id=”headd ”>this is heading</h>

2.14: HTML TABLE

HTML tables allow web developers to arrange data into rows and columns.

Example:

<table>
<tr>
<th>Company</th>
<th>Contact</th>
<th>Country</th>
</tr>
<tr>
<td>Alfreds Futterkiste</td>
<td>Maria Anders</td>
<td>Germany</td>
</tr>
<tr>
<td>Centro comercial Moctezuma</td>
<td>Francisco Chang</td>
<td>Mexico</td>
</tr>
</table>

18
Output:

Company Contact Country


Alfreds Futterkiste Maria Anders Germany
Centro comercial Moctezuma Francisco Chang Mexico

2.15:HTML Forms
An HTML form is used to collect user input. The user input is most often sent to a server for
processing.

Example:
First name:
Paras

Last name:
Deepak

2.15. : HTML Input Tags

The HTML <input> element is the most used form element.

An <input> element can be displayed in many ways, depending on the type attribute.

Example:
<input type=”text”>
<input type=”radio”>
<input type=”checkbox”>

Chapter 3: Introduction to CSS

19
3.0: Introduction

• CSS stands for Cascading Style Sheets


• CSS describes how HTML elements are to be displayed on screen, paper, or in other media
• CSS saves a lot of work. It can control the layout
• External stylesheets are stored in CSS files

Example:

body {
background-color: lightblue;
}

h1{
color: white;
text-align: center;
}

p{
font-family: verdana;
font-size: 20px;
}

3.1.1: CSS Selectors

CSS selectors are used to "find" (or select) the HTML elements you want to style.

We can divide CSS selectors into five categories:

• Simple selectors (select elements based on name, id, class)


• Combinator selectors (select elements based on a specific relationship between them)
• Pseudo-class selectors (select elements based on a certain state)
• Pseudo-elements selectors (select and style a part of an element)
• Attribute selectors (select elements based on an attribute or attribute value)

3.1.2: CSS Id Selectos

The id selector uses the id attribute of an HTML element to select a specific element.

The id of an element is unique within a page, so the id selector is used to select one unique element!

To select an element with a specific id, write a hash (#) character, followed by the id of the element.

Example:
20
#para1 {
text-align: center;
color: red;
}

3.1.3: CSS Class Selectors

The class selector selects HTML elements with a specific class attribute.

To select elements with a specific class, write a period (.) character, followed by the class name.

Example:

.center {
text-align: center;
color: red;
}

3.1.4: CSS Universal Selectors

The universal selector (*) selects all HTML elements on the page.

Example:

*{
margin: 0px;
padding: 0px;
}

3.2.0: CSS Comments

Comments are used to explain the code, and may help when you edit the source code at a later date.

Comments are ignored by browsers.

A CSS comment is placed inside the <style> element, and starts with /* and ends with */:

Example:

p{
color: red; /* Set text color to red */
}

21
3.3.0: CSS Background

The CSS background properties are used to add background effects for elements.

In these chapters, you will learn about the following CSS background properties:

• background-color
• background-image
• background-repeat
• background-attachment
• background-position
• background (shorthand property)

Example:

body {
background-color: lightblue;
}

3.4.0: CSS Borders

The CSS border properties allow you to specify the style, width, and color of an element's border.

CSS Border Style:

The border style property specifies what kind of border to display.

The following values are allowed:

• dotted - Defines a dotted border


• dashed - Defines a dashed border
• solid - Defines a solid border
• double - Defines a double border
• groove - Defines a 3D grooved border. The effect depends on the border-color value
• ridge - Defines a 3D ridged border. The effect depends on the border-color value
• inset - Defines a 3D inset border. The effect depends on the border-color value
• outset - Defines a 3D outset border. The effect depends on the border-color value
• none - Defines no border
• hidden - Defines a hidden border
22
The border style property can have from one to four values (for the top border, right border, bottom border,
and the left border).

3.5.0: CSS Margins

The CSS margin properties are used to create space around elements, outside of any defined borders.

With CSS, you have full control over the margins. There are properties for setting the margin for each
side of an element (top, right, bottom, and left).

CSS has properties for specifying the margin for each side of an element:

• margin-top
• margin-right
• margin-bottom
• margin-left

All the margin properties can have the following values:

• auto - the browser calculates the margin


• length - specifies a margin in px, pt, cm, etc.
• %- specifies a margin in % of the width of the containing element
• inherit - specifies that the margin should be inherited from the parent element

3.6.0: CSS Padding

Padding is used to create space around an element's content, inside of any defined borders. The
CSS padding properties are used to generate space around an element's content, inside of any defined
borders.

With CSS, you have full control over the padding. There are properties for setting the padding for each
side of an element (top, right, bottom, and left).

CSS has properties for specifying the padding for each side of an element:

• padding-top
23
• padding-right
• padding-bottom
• padding-left

All the padding properties can have the following values:

• length - specifies a padding in px, pt, cm, etc.


• % - specifies a padding in % of the width of the containing element
• inherit - specifies that the padding should be inherited from the parent element

Example:

div {
padding-top: 50px;
padding-right: 30px;
padding-bottom: 50px;
padding-left: 80px;
}

3.7.0: CSS Height and Width

The height and width properties are used to set the height and width of an element.

The height and width properties do not include padding, borders, or margins. It sets the height/width of
the area inside the padding, border, and margin of the element.

# CSS height and width Values

The height and width properties may have the following values:

• auto - This is default. The browser calculates the height and width
• length - Defines the height/width in px, cm etc.
• % - Defines the height/width in percent of the containing block
• initial - Sets the height/width to its default value
• inherit - The height/width will be inherited from its parent value
24
example:

div {
height: 200px;
width: 50%;
background-color: powderblue;
}

with max-width

div {
max-width: 500px;
height: 100px;
background-color: powderblue;
}

25
Chapter 4: Bootstrap

4.0: Introduction to Bootstrap

It is an open-source and free CSS framework, which helps in directing a responsive device-friendly
mobile-first front-end web page development tool. Bootstrap includes the CSS (Cascading Style
Sheets), and an optional JavaScript supported design template (plug-ins) that deals with typography,
implementation of buttons, forms, and various other components user interface. This framework helps
in faster web development and supports developers in creating responsive web pages faster.

4.1.0: Bootstrap Component

The bootstrap consists of three main files. These are:

• Bootstrap CSS: a CSS framework.


• Bootstrap js: a JavaScript / jQuery framework.
• glyphicons: a font (an icon font set).

Also, Bootstrap needs jQuery for functioning. jQuery is an exceptionally admired and commonly used
JavaScript library which simplifies the cross-browser compatible functionality.

4.2.0: Link for using Bootstrap


Link= <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css"
rel="stylesheet" integrity="sha384-
EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
crossorigin="anonymous">

Example:
26
<form action="/html/tags/html_form_tag_action.cfm">

<div class="form-group">

<label for="first_name">First Name</label>

<input type="text" class="form-control" id="first_name" name="first_name">

</div>

<div class="form-group">

<label for="last_name">Last Name</label>

<input type="text" class="form-control" id="last_name" name="last_name">

</div>

<button type="submit" class="btn btn-default">Submit</button>

</form>

Chapter 5: JAVA SCRIPT

5.0.1: INTRODUCTION

JavaScript is the world's most popular programming language.

JavaScript is the programming language of the Web.

JavaScript is easy to learn.

This tutorial will teach you JavaScript from basic to advanced.

Syntax:

// How to create variables:


var x;
let y;

// How to use variables:


x = 5;
27
y = 6;
let z = x + y;

=>The JavaScript syntax defines two types of values:

• Fixed values
• Variable values

Fixed values are called Literals.

Variable values are called Variables.

5.1.0: Javascript Variables


4 Ways to Declare a JavaScript Variable:

• Using var
• Using let
• Using const
• Using nothing

Example of var:

var x = 5;
var y = 6;
var z = x + y;

5.2.0: Javascript If else

If statement
Use the if statement to specify a block of JavaScript code to be executed if a condition is true.

Syntax: if (condition) {
// block of code to be executed if the condition is true
}

Example:

28
if (hour < 18) {
greeting = "Good day";
}

if else:

Use the else statement to specify a block of code to be executed if the condition is false.

Syntax: if (condition) {
// block of code to be executed if the condition is true
} else {
// block of code to be executed if the condition is false
}

Example:

if (hour < 18) {


greeting = "Good day";
} else {
greeting = "Good evening";
}

5.3.0: Javascript Loops

Loops can execute a block of code a number of times.

JavaScript supports different kinds of loops:

• for - loops through a block of code a number of times


• for/in - loops through the properties of an object
• for/of - loops through the values of an iterable object
• while - loops through a block of code while a specified condition is true
• do/while - also loops through a block of code while a specified condition is true

for loop:

The for loop has the following syntax:

for (statement 1; statement 2; statement 3) {


// code block to be executed
}

example:

29
for (let i = 0; i < 5; i++) {
text += "The number is " + i + "<br>";
}

While loop:

The while loop loops through a block of code as long as a specified condition is true.

Syntax: while (condition) {


// code block to be executed
}

Example:

while (i < 10) {


text += "The number is " + i;
i++;
}

5.4.0: Functions

A JavaScript function is a block of code designed to perform a particular task.

A JavaScript function is executed when "something" invokes it (calls it).

Syntax:

function name(parameter1, parameter2, parameter3) {


// code to be executed
}

Example:

function myFunction(p1, p2) {


return p1 * p2; // The function returns the product of p1 and p2
}

5.5.0: Javascript Arrays

JavaScript array is an object that represents a collection of similar type of elements.

There are 3 ways to construct array in JavaScript

1. By array literal
2. By creating instance of Array directly (using new keyword)
30
3. By using an Array constructor (using new keyword)

Syntax:

var arrayname=[value1,value2.....valueN];

Example:
<script>
var emp=["Sonoo","Vimal","Ratan"];

for (i=0;i<emp.length;i++)
{
document.write(emp[i] + "<br/>");
}
</script>

5.6.0: Javascript Cookies


Web Browsers and Servers use HTTP protocol to communicate and HTTP is a stateless protocol. But
for a commercial website, it is required to maintain session information among different pages. For
example, one user registration ends after completing many pages. But how to maintain users' session
information across all the web pages.

In many situations, using cookies is the most efficient method of remembering and tracking
preferences, purchases, commissions, and other information required for better visitor experience or site
statistics.

Cookies are a plain text data record of 5 variable-length fields −


• Expires − The date the cookie will expire. If this is blank, the cookie will expire when the
visitor quits the browser.
• Domain − The domain name of your site.
• Path − The path to the directory or web page that set the cookie. This may be blank if you want
to retrieve the cookie from any directory or page.
• Secure − If this field contains the word "secure", then the cookie may only be retrieved with a
secure server. If this field is blank, no such restriction exists.
• Name=Value − Cookies are set and retrieved in the form of key-value pairs

31
The simplest way to create a cookie is to assign a string value to the document.cookie object, which
looks like this.

document.cookie = "key1 = value1;key2 = value2;expires = date";

5.7.0: Javascript Object Overview

JavaScript is an Object Oriented Programming (OOP) language. A programming language can be


called object-oriented if it provides four basic capabilities to developers −

• Encapsulation − the capability to store related information, whether data or methods, together
in an object.
• Aggregation − the capability to store one object inside another object.
• Inheritance − the capability of a class to rely upon another class (or number of classes) for
some of its properties and methods.
• Polymorphism − the capability to write one function or method that works in a variety of
different ways.

Object properties can be any of the three primitive data types, or any of the abstract data types, such as
another object. Object properties are usually variables that are used internally in the object's methods,
but can also be globally visible variables that are used throughout the page.

The syntax for adding a property to an object is – objectName.objectProperty = propertyValue;

32
Chapter 6: PHP
6.0: Introduction

• PHP is an acronym for "PHP: Hypertext Preprocessor"


• PHP is a widely-used, open source scripting language
• PHP scripts are executed on the server
• PHP is free to download and use
• PHP files can contain text, HTML, CSS, JavaScript, and PHP code
• PHP code is executed on the server, and the result is returned to the browser as plain HTML
• PHP files have extension ".php"
• PHP can generate dynamic page content
• PHP can create, open, read, write, delete, and close files on the server
• PHP can collect form data
• PHP can send and receive cookies
• PHP can add, delete, modify data in your database
• PHP can be used to control user-access
• PHP can encrypt data

6.1.0: PHP Variables

In PHP, a variable starts with the $ sign, followed by the name of the variable:

Rules for PHP variables:

• A variable starts with the $ sign, followed by the name of the variable
• A variable name must start with a letter or the underscore character
• A variable name cannot start with a number
• A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ )
• Variable names are case-sensitive ($age and $AGE are two different variables)
33
Example:

<?php
$txt = "Hello world!";
$x = 5;
$y = 10.5;
?>

6.2.0: PHP Echo And Print

echo and print are more or less the same. They are both used to output data to the screen.

The differences are small: echo has no return value while print has a return value of 1 so it can be used
in expressions. echo can take multiple parameters (although such usage is rare) while print can take one
argument. echo is marginally faster than print.

Example:

Echo statement:

<?php
echo "<h2>PHP is Fun!</h2>";
echo "Hello world!<br>";
echo "I'm about to learn PHP!<br>";
echo "This ", "string ", "was ", "made ", "with multiple parameters.";
?>

Print statement:

<?php
print "<h2>PHP is Fun!</h2>";
print "Hello world!<br>";
print "I'm about to learn PHP!";
?>

34
6.3.0: PHP Data Types

Variables can store data of different types, and different data types can do different things.

PHP supports the following data types:

• String
• Integer
• Float (floating point numbers - also called double)
• Boolean
• Array
• Object
• NULL
• Resource

Example:

<?php
$x = 5985;

$y=” Hello World”;


var_dump($x);

echo $y;
?>

6.4.0: PHP if else

In PHP we have the following conditional statements:

• if statement - executes some code if one condition is true


• if...else statement - executes some code if a condition is true and another code if that condition
is false
• if...elseif...else statement - executes different codes for more than two conditions
• switch statement - selects one of many blocks of code to be executed

PHP if Statement

35
Syntax: If (condition) {
code to be executed if condition is true;
}

Example:

<?php
$t = date("H");

if ($t < "20") {


echo "Have a good day!";
}
?>

PHP if else Statement

The if...else statement executes some code if a condition is true and another code if that condition is
false.

Syntax: if (condition) {
code to be executed if condition is true;
} else {
code to be executed if condition is false;
}

Example:

<?php
$t = date("H");

if ($t < "20") {


echo "Have a good day!";
}

else {
echo "Have a good night!";
}
?>

36
PHP if elseif else Statement

The if...elseif...else statement executes different codes for more than two conditions.

Syntax: if (condition) {
code to be executed if this condition is true;
} elseif (condition) {
code to be executed if first condition is false and this condition is true;
} else {
code to be executed if all conditions are false;
}

Example:

<?php
$t = date("H");

if ($t < "10") {


echo "Have a good morning!";
} elseif ($t < "20") {
echo "Have a good day!";
} else {
echo "Have a good night!";
} ?>

6.5.0:PHP Loops

Loops are used to execute the same block of code again and again, as long as a certain condition is true

In PHP, we have the following loop types:

• while - loops through a block of code as long as the specified condition is true
• do...while - loops through a block of code once, and then repeats the loop as long as the
specified condition is true
• for - loops through a block of code a specified number of times
• foreach - loops through a block of code for each element in an array

6.5.1:While loop

37
The while loop - Loops through a block of code as long as the specified condition is true.

Syntax: while (condition is true) {


code to be executed;
}

Example:

<?php
$x = 1;

while($x <= 5) {
echo "The number is: $x <br>";
$x++;
}
?>

6.5.2: for loop


The for loop - Loops through a block of code a specified number of times.

Syntax: for (init counter; test counter; increment counter)

{
code to be executed for each iteration;
}

Example:

<?php
for ($x = 0; $x <= 10; $x++)

{
echo "The number is: $x <br>";
}
?>

6.5.3: foreach loop


The foreach loop - Loops through a block of code for each element in an array

Syntax: foreach ($array as $value) {


code to be executed;
}

38
Example: <?php
$colors = array("red", "green", "blue", "yellow");

foreach ($colors as $value) {


echo "$value <br>";
}
?>

6.6.0: PHP Functions

PHP has over 1000 built-in functions that can be called directly, from within a script, to perform a
specific task.

Besides the built-in PHP functions, it is possible to create your own functions.

• A function is a block of statements that can be used repeatedly in a program.


• A function will not execute automatically when a page loads.
• A function will be executed by a call to the function.

Syntax: function functionName() {


code to be executed;
}

Example:

<?php
function writeMsg() {
echo "Hello world!";
}

writeMsg(); // call the function


?>

6.7.0:PHP Arrays

An array stores multiple values in one single variable:

Syntax: array();

In PHP, there are three types of arrays:

• Indexed arrays - Arrays with a numeric index


39
• Associative arrays - Arrays with named keys
• Multidimensional arrays - Arrays containing one or more arrays

Example:

<?php
$cars = array("Volvo", "BMW", "Toyota");
echo count($cars);
?>

6.8.0:PHP Strings

They are sequences of characters, like "PHP supports string operations".

NOTE − Built-in string functions is given in function reference PHP String Functions

Following are valid examples of string

$string_1 = "This is a string in double quotes";


$string_2 = "This is a somewhat longer, singly quoted string";
$string_39 = "This string has thirty-nine characters";
$string_0 = ""; // a string with zero characters

6.9.0: PHP GET and POST Method


There are two ways the browser client can send information to the web server.

• The GET Method


• The POST Method

#The GET Method


The GET method sends the encoded user information appended to the page request. The page and the
encoded information are separated by the ? character.

Example: http://www.test.com/index.htm?name1=value1&name2=value2

• The GET method produces a long string that appears in your server logs, in the browser's
Location: box.
• The GET method is restricted to send upto 1024 characters only.

40
• Never use GET method if you have password or other sensitive information to be sent to the
server.
• GET can't be used to send binary data, like images or word documents, to the server.
• The data sent by GET method can be accessed using QUERY_STRING environment variable.
• The PHP provides $_GET associative array to access all the sent information using GET
method.

#The POST Method

The POST method transfers information via HTTP headers. The information is encoded as described in
case of GET method and put into a header called QUERY_STRING.

• The POST method does not have any restriction on data size to be sent.
• The POST method can be used to send ASCII as well as binary data.
• The data sent by POST method goes through HTTP header so security depends on HTTP
protocol. By using Secure HTTP you can make sure that your information is secure.
• The PHP provides $_POST associative array to access all the sent information using POST
method.

6.8.0: PHP MYSQL Database

• MySQL is a database system used on the web


• MySQL is a database system that runs on a server
• MySQL is ideal for both small and large applications
• MySQL is very fast, reliable, and easy to use
• MySQL uses standard SQL
• MySQL compiles on a number of platforms
• MySQL is free to download and use
• MySQL is developed, distributed, and supported by Oracle Corporation
• MySQL is named after co-founder Monty Widenius's daughter: My

41
The data in a MySQL database are stored in tables. A table is a collection of related data, and it
consists of columns and rows.

6.8.1: MYSQL Connect

<?php
$servername = "localhost";
$username = "username";
$password = "password";

// Create connection
$conn = new mysqli($servername, $username, $password);

// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
?>

6.8.2: MYSQL Creating and Inserting in Database

// Create database
$sql = "CREATE DATABASE myDB";
if ($conn->query($sql) === TRUE) {
echo "Database created successfully";
} else {
echo "Error creating database: " . $conn->error;
}

// Inserting into database

42
$sql = "INSERT INTO MyGuests (firstname, lastname, email)
VALUES ('kashif', 'quamar', 'kashif@example.com')";

if ($conn->query($sql) === TRUE) {


echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}

Chapter 7:- Web Devlopment Project

7.1.1 Introduction
I am working on a RED STORE project.

This project is very beneficial if any one wants to go in website


development field.The Programming language that we used in this project is follows:

*HTML

*CSS

*BOOTSTRAP

*JAVASCRIPT

*PHP+MYSQL

7.1.2 : Tools for project

The tools that we given in this project is as follows:-

• Title Name
• About US

43
• Contact
• Profile
• Add to cart
• View to Know more
• Our specials
• Logout

7.1.3: Steps for Creating project and Database

1. Createda folder name project in vscode of in ‘htdocs’ in xampp folder

2. Used the folder in vscode

3. Created home page using HTML

4. Used CSS to decorate it.

5. Created a login and signin page

6. Now first created database in Localhost/php/myadmin

7. First created a database using name “Customers”

8. Created Table using 11 rows using name customers using column name like name ,email
mobile_no ,road_name,city_name etc;

9. Now connected my databse to php file in vs code

10. Now created admin panel and user panel

11. Created comments section

Chapter 8:- Results And Discussuion

Result:
Finally applying many operations and many programming language this project has been
completed.

This project(Red Store)include many pages through which any number of traffic can come ade
44
can do their operation according to their requirements. The PHP pages that it consists of:

1. Home page

2. Profile page

3. Signin page

4. Login page

5. About us page

6. All Admin

7. Contact us page

8. Users page

9. Admins page

10. My cart page

I think the test did went smoothly and I had no problems,except for the fact that the some
operations that I could not do .

Therefore, I had to take the sorry quickly

Discussion:

This site is used for buying sports related things this website redstore helps user to buy all
equipments used in sports & Gymming. Your priority is our First work.This plateform provides
many facilities to our users or customers by both ways offline and online ways (expect for 11pm
to 7am).we hope you all feel better experience to this site

45
Chapter 9:- Conclusion and future Scope

46
47
Conclusion:
During making of this project I learned so many things. This project is completed on VS code
48
using Frontend Languages like ,HTML ,CSS, Javascript and backend languge PHP. One of the
most beneficial work of this site that delivery of foods id free of cost and fresh within 7km.

49

You might also like