php report.doc

37
Seven Wonder Acknowledgement It was highly educative and interactive to take training at Rising HIeights & company, it was a good chance for learning and practicing new things to update our self. I am highly thankful to the respected In charge Mr. Kanav Sharma for allowing me t o join the Tr aining and motivating me to do the right things. I also take the opportunity to thanks Mr. Harjot Brar for his guidance in field of technology Shipra Goyal (21101185)

Upload: narinder-bansal

Post on 14-Apr-2018

251 views

Category:

Documents


0 download

TRANSCRIPT

7/27/2019 php report.doc

http://slidepdf.com/reader/full/php-reportdoc 1/37

Seven Wonder

Acknowledgement

It was highly educative and interactive to take training at Rising

HIeights & company, it was a good chance for learning and

practicing new things to update our self.

I am highly thankful to the respected In charge Mr. Kanav Sharma

for allowing me to join the Training and motivating me to do the

right things. I also take the opportunity to thanks Mr. Harjot Brar

for his guidance in field of technology

7/27/2019 php report.doc

http://slidepdf.com/reader/full/php-reportdoc 2/37

Seven Wonder

Preface

An engineer has to serve the market, for that one must know about

the demands and requirements in the market, the way of 

tackling the hurdles and find a way of working out for their

solutions at the right place.

After the completion of four year degree course an engineer must

have a thorough knowledge about the theory and practical. For

this one must be practically sound with theory aspects.

 To make the engineer good at practical the engineering courses

provides a 5-6 weeks industrial training where one gets the

opportunity to apply the theory in practical processes and

production.

We have been lucky to get a chance for undergoing this training at

Rising heights and company. This report has been prepared on

the basis of knowledge acquired by us during training period of 

45 days at the company.

7/27/2019 php report.doc

http://slidepdf.com/reader/full/php-reportdoc 3/37

Seven Wonder

Contents of Training report

1) Basics of html

2)Tags in html

3)CSS (cascading style sheet)

4)font style

5)Javascript

6) Core php

7)Project on environment system

8)Use of templates

9)Personality development

10)Updates on technology

7/27/2019 php report.doc

http://slidepdf.com/reader/full/php-reportdoc 4/37

Seven Wonder

7/27/2019 php report.doc

http://slidepdf.com/reader/full/php-reportdoc 5/37

Seven Wonder

What is HTML?

HTML is a language for describing web pages.

HTML stands for Hyper Text Markup Language

HT1ML is not a programming language, it is a markup language

A markup language is a set of markup tags

 The purpose of the tags are to describe page content

Shipra Goyal (21101185)

7/27/2019 php report.doc

http://slidepdf.com/reader/full/php-reportdoc 6/37

Seven Wonder

HTML Tags

HTML markup tags are usually called HTML tags

HTML tags are keywords (tag names) surrounded by angle brackets like

<html>

HTML tags normally come in pairs like <b> and </b>

 The first tag in a pair is the start tag, the second tag is the end tag

 The end tag is written like the start tag, with a forward slash before the tag

name

Start and end tags are also called opening tags and closing tags

HTML Elements"HTML tags" and "HTML elements" are often used to describe

the same thing.

But strictly speaking, an HTML element is everything between the start tag

and the end tag, including the tags:

HTML Element

HTML Documents = Web Pages

HTML documents describe web pages

Shipra Goyal (21101185)

7/27/2019 php report.doc

http://slidepdf.com/reader/full/php-reportdoc 7/37

Seven Wonder

HTML documents contain HTML tags and plain text

HTML documents are also called web pages

Syntax of HTML

<HTML>

<HEAD>

<TITLE></TITLE>

</HEAD>

<BODY>

</BODY>

</HTML>

 Types of tags

Pargraph tags

Bold tag

Italic tag

Underline

Shipra Goyal (21101185)

7/27/2019 php report.doc

http://slidepdf.com/reader/full/php-reportdoc 8/37

Seven Wonder

Break

Horizontal rule

Div tag

Anchor tag

Img tag

Form(input,text area)

 Table(td,tr,th)

List (ol,ul,dl ) (li,dd,dt)

FRAMES

FORM

IFRAME

HEADING TAGS(h1,H2,H3,H4,H5,H6)

Shipra Goyal (21101185)

7/27/2019 php report.doc

http://slidepdf.com/reader/full/php-reportdoc 9/37

Seven Wonder

SMALL TAG

STRONG TAG

STYLE TAG

SCRIPT TAG

HEAD TAG

BODY TAG

HTML TAGS

SUP TAG (super script)

SUB TAG(subscript)

STRIKE TAG

BUTTON

PRE

LINK 

FONT TAG

BIG TAG

Shipra Goyal (21101185)

7/27/2019 php report.doc

http://slidepdf.com/reader/full/php-reportdoc 10/37

Seven Wonder

CSS(cascading style sheet)

What is CSS?CSS stands for Cascading Style Sheets Styles define how to

display HTML elements. Styles were added to HTML 4.0 to solve a

problem. External Style Sheets can save a lot of work. External Style

Sheets are stored in CSS files.

CSS Syntax

A CSS rule has two main parts: a selector, and one or more declarations:

 The selector is normally the HTML element you want to style.

Each declaration consists of a property and a value.

 The property is the style attribute you want to change. Each property has a

value.

Shipra Goyal (21101185)

7/27/2019 php report.doc

http://slidepdf.com/reader/full/php-reportdoc 11/37

Seven Wonder

CSS Example

A CSS declaration always ends with a semicolon, and declaration groups are

surrounded by curly brackets:

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

 To make the CSS more readable, you can put one declaration on each line,

like this

EXAMPLE

p

{

color:red;

text-align:center;

}

CSS Styling

Styling Backgrounds

Styling Text

Styling Fonts

Styling LinksStyling Lists

Styling Tables

Shipra Goyal (21101185)

7/27/2019 php report.doc

http://slidepdf.com/reader/full/php-reportdoc 12/37

Seven Wonder

 The id and class Selectors

In addition to setting a style for a HTML element, CSS allows you to specify

your own selectors called "id" and "class".

 The id Selector

 The id selector is used to specify a style for a single, unique element.The id

selector uses the id attribute of the HTML element, and is defined with a

"#".

 The style rule below will be applied to the element with id="para1":

Example

#para1

{

text-align:center;color:red;

}

Do NOT start an ID name with a number! It will not work in Mozilla/Firefox.

Shipra Goyal (21101185)

7/27/2019 php report.doc

http://slidepdf.com/reader/full/php-reportdoc 13/37

Seven Wonder

 The class Selector

 The class selector is used to specify a style for a group of elements. Unlike

the id selector, the class selector is most often used on several elements.

 This allows you to set a particular style for many HTML elements with the

same class.

 The class selector uses the HTML class attribute, and is defined with a "."

In the example below, all HTML elements with class="center" will be center-aligned:

Example

.center {text-align:center;

 You can also specify that only specific HTML elements should be affected bya class.

In the example below, all p elements with class="center" will be center-

aligned:

Example

p.center {text-align:center;}

Shipra Goyal (21101185)

7/27/2019 php report.doc

http://slidepdf.com/reader/full/php-reportdoc 14/37

Seven Wonder

 JavaScript was designed to add interactivity to HTML pages

 JavaScript is a scripting language

A scripting language is a lightweight programming language

 JavaScript is usually embedded directly into HTML pages

 JavaScript is an interpreted language (means that scripts execute without

preliminary compilation)

Everyone can use JavaScript without purchasing a license

 JavaScript is THE scripting language of the Web.

 JavaScript is used in billions of Web pages to add functionality, validate

forms, communicate with the server, and much more.

Shipra Goyal (21101185)

7/27/2019 php report.doc

http://slidepdf.com/reader/full/php-reportdoc 15/37

Seven Wonder

What Can JavaScript do?

 JavaScript gives HTML designers a programming tool - HTML authors are

normally not programmers, but JavaScript is a scripting language with

a very simple syntax! Almost anyone can put small "snippets" of code

into their HTML pages

 JavaScript can react to events - A JavaScript can be set to execute when

something happens, like when a page has finished loading or when a

user clicks on an HTML element

 JavaScript can manipulate HTML elements - A JavaScript can read and

change the content of an HTML element

 JavaScript can be used to validate data - A JavaScript can be used to validate

form input

Example

My First Web Page

 This is a paragraph.

Display Date

Shipra Goyal (21101185)

7/27/2019 php report.doc

http://slidepdf.com/reader/full/php-reportdoc 16/37

Seven Wonder

 JavaScript  The HTML <script> tag is used to insert a JavaScript into an HTML document.

 The HTML "id" attribute is used to identify HTML elements.

Manipulating HTML Elements

Shipra Goyal (21101185)

7/27/2019 php report.doc

http://slidepdf.com/reader/full/php-reportdoc 17/37

Seven Wonder

 JavaScript is typically used to manipulate existing HTML elements.

 The HTML "id" attribute is used to identify HTML elements.

 To access an HTML element from a JavaScript, use the

document.getElementById() method.

 The document.getElementById() method will access the HTML element with

the specified id.

Example

Access the HTML element with the specified id, and change its content:

<!DOCTYPE html>

<html>

<body>

<h1>My First Web Page</h1>

<p id="demo">My First Paragraph</p>

<script type="text/javascript">

document.getElementById("demo").innerHTML="My First JavaScript";

</script>

</body>

</html>

Write Directly into The HTML Document

Shipra Goyal (21101185)

7/27/2019 php report.doc

http://slidepdf.com/reader/full/php-reportdoc 18/37

Seven Wonder

 The example below writes a <p> element into the HTML document:

Example

<!DOCTYPE html>

<html>

<body>

<h1>My First Web Page</h1>

<script type="text/javascript">

document.write("<p>My First JavaScript</p>");

</script>

</body>

</html>

 JavaScript Functions in <head>

Shipra Goyal (21101185)

7/27/2019 php report.doc

http://slidepdf.com/reader/full/php-reportdoc 19/37

Seven Wonder

 The example below calls a function when a button is clicked:

Example

<!DOCTYPE html>

<html>

<head>

<script type="text/javascript">

function myFunction()

{

document.getElementById("demo").innerHTML="My First JavaScript

Function";

}

</script>

</head>

<body>

<h1>My Web Page</h1>

<p id="demo">A Paragraph</p>

<button type="button" onclick="myFunction()">Try it</button>

</body>

</html>

 JavaScript if else Statements

Conditional statements are used to perform different actions based on

different conditions.

Shipra Goyal (21101185)

7/27/2019 php report.doc

http://slidepdf.com/reader/full/php-reportdoc 20/37

Seven Wonder

Conditional Statements

Very often when you write code, you want to perform different actions fordifferent decisions. You can use conditional statements in your code to

do this.

In JavaScript we have the following conditional statements:

if statement - use this statement to execute some code only if a specified

condition is true

if...else statement - use this statement to execute some code if the conditionis true and another code if the condition is false

if...else if....else statement - use this statement to select one of many blocks

of code to be executed

switch statement - use this statement to select one of many blocks of code

to be executed

Shipra Goyal (21101185)

7/27/2019 php report.doc

http://slidepdf.com/reader/full/php-reportdoc 21/37

Seven Wonder

If Statement

Use the if statement to execute some code only if a specified condition is

true.

Syntax

if (condition)

{

  code to be executed if condition is true

}

Note that if  is written in lowercase letters. Using uppercase letters (IF) will

generate a JavaScript error!

EXAMPLE

Make a "Good day" greeting if the time if less than 20:00:

if (time<20)

{

x="Good day";

}

 The result of   x  will be:

Good day

Shipra Goyal (21101185)

7/27/2019 php report.doc

http://slidepdf.com/reader/full/php-reportdoc 22/37

Seven Wonder

PHP(HYPERTEXT PREPROCESSER)

PHP is a powerful tool for making dynamic and interactive Web pages.

PHP is the widely-used, free, and efficient alternative to competitors such as

Microsoft's ASP.

In our PHP tutorial you will learn about PHP, and how to execute scripts on

your server.

Shipra Goyal (21101185)

7/27/2019 php report.doc

http://slidepdf.com/reader/full/php-reportdoc 23/37

Seven Wonder

What is PHP?

PHP stands for PHP: Hypertext Preprocessor

PHP is a server-side scripting language, like ASP

PHP scripts are executed on the server

PHP supports many databases (MySQL, Informix, Oracle, Sybase, Solid,

PostgreSQL, Generic ODBC, etc.)

PHP is an open source software

PHP is free to download and use

What is a PHP File?

PHP files can contain text, HTML tags and scripts

PHP files are returned to the browser as plain HTML

PHP files have a file extension of ".php", ".php3", or ".phtml"

Shipra Goyal (21101185)

7/27/2019 php report.doc

http://slidepdf.com/reader/full/php-reportdoc 24/37

Seven Wonder

What is MySQL?

MySQL is a database server

MySQL is ideal for both small and large applications

MySQL supports standard SQL

MySQL compiles on a number of platforms

MySQL is free to download and use

PHP + MySQL

PHP combined with MySQL are cross-platform (you can develop in Windowsand serve on a Unix platform)

Why PHP?

PHP runs on different platforms (Windows, Linux, Unix, etc.)

PHP is compatible with almost all servers used today (Apache, IIS, etc.)

PHP is easy to learn and runs efficiently on the server side

PHP Syntax

 The PHP script is executed on the server, and the plain HTML result is sent

back to the browser.

Basic PHP Syntax :A PHP script always starts with <?php and ends with ?>. A

PHP script can be placed anywhere in the document.

On servers with shorthand-support, you can start a PHP script with <? and

end with ?>.

For maximum compatibility, we recommend that you use the standard form

(<?php) rather than the shorthand form.

Shipra Goyal (21101185)

7/27/2019 php report.doc

http://slidepdf.com/reader/full/php-reportdoc 25/37

Seven Wonder

<?php

?>

A PHP file must have a .php extension.

A PHP file normally contains HTML tags, and some PHP scripting code.

Below, we have an example of a simple PHP script that sends the text "Hello

World" back to the browser:

<html><body>

<?php

echo "Hello World";

?>

</body>

</html>

Each code line in PHP must end with a semicolon. The semicolon is a

separator and is used to distinguish one set of instructions from another.

 There are two basic statements to output text with PHP: echo and print.

In the example above we have used the echo statement to output the text

"Hello World".

Shipra Goyal (21101185)

7/27/2019 php report.doc

http://slidepdf.com/reader/full/php-reportdoc 26/37

Seven Wonder

PHP Variables

As with algebra, PHP variables are used to hold values or expressions.

A variable can have a short name, like x, or a more descriptive name, like

carName.

Rules for PHP variable names:

Variables in PHP starts with a $ sign, followed by the name of the variable

 The variable name must begin with a letter or the underscore character

A variable name can only contain alpha-numeric characters and underscores

(A-z, 0-9, and _ )

A variable name should not contain spaces

Variable names are case sensitive (y and Y are two different variables)

Creating (Declaring) PHP Variables

PHP has no command for declaring a variable.

A variable is created the moment you first assign a value to it:

$a="hello";

<?php

$txt="Hello World!";

$x=16;

?>

Shipra Goyal (21101185)

7/27/2019 php report.doc

http://slidepdf.com/reader/full/php-reportdoc 27/37

Seven Wonder

The if Statement

Use the if statement to execute some code only if a specified condition is

true.

Syntax if (condition) code to be executed if condition is true;

 The following example will output "Have a nice weekend!" if the current day

is Friday:

<html><body>

<?php

$d=date("D");

if ($d=="Fri") echo "Have a nice weekend!";

?>

</body>

</html>

Shipra Goyal (21101185)

7/27/2019 php report.doc

http://slidepdf.com/reader/full/php-reportdoc 28/37

Seven Wonder

te if...else Statement

Use the if....else statement to execute some code if a condition is true and

another code if a condition is false.

Syntax

if (condition)

{

code to be executed if condition is true;

  }

else

{code to be executed if condition is false;

  }

Example

 The following example will output "Have a nice weekend!" if the current day

is Friday, otherwise it will output "Have a nice day!":

<html>

<body>

<?php

$d=date("D");

if ($d=="Fri")

{

echo "Have a nice weekend!";

}

Shipra Goyal (21101185)

7/27/2019 php report.doc

http://slidepdf.com/reader/full/php-reportdoc 29/37

Seven Wonder

else

{

echo "Have a nice day!";

}

?>

</body>

</html>

 The if...else if....else Statement

Use the if....elseif...else statement to select one of several blocks of code to

be executed.

Syntax

if (condition)

{

code to be executed if condition is true;

}

elseif (condition)

{

code to be executed if condition is true;

}

else

{

code to be executed if condition is false;

}

Shipra Goyal (21101185)

7/27/2019 php report.doc

http://slidepdf.com/reader/full/php-reportdoc 30/37

Seven Wonder

Example

 The following example will output "Have a nice weekend!" if the current day

is Friday, and "Have a nice Sunday!" if the current day is Sunday.

Otherwise it will output "Have a nice day!":

<html>

<body>

<?php

$d=date("D");

if ($d=="Fri")

{

echo "Have a nice weekend!";

}

elseif ($d=="Sun")

{

echo "Have a nice Sunday!";

}

else

{

echo "Have a nice day!";

}

?>

</body></html>

Shipra Goyal (21101185)

7/27/2019 php report.doc

http://slidepdf.com/reader/full/php-reportdoc 31/37

Seven Wonder

 The $_GET Variable

 The predefined $_GET variable is used to collect values in a form with

method="get"

Information sent from a form with the GET method is visible to everyone (it

will be displayed in the browser's address bar) and has limits on the

amount of information to send.

Example

<form action="welcome.php" method="get">

Name: <input type="text" name="fname" />

Age: <input type="text" name="age" />

<input type="submit" />

</form>

 The "welcome.php" file can now use the $_GET variable to collect form data

(the names of the form fields will automatically be the keys in the $_GET

array):

Welcome <?php echo $_GET["fname"]; ?>.<br />

 You are <?php echo $_GET["age"]; ?> years old!

Shipra Goyal (21101185)

7/27/2019 php report.doc

http://slidepdf.com/reader/full/php-reportdoc 32/37

Seven Wonder

The $_POST Variable

 The predefined $_POST variable is used to collect values from a form sent

with method="post".

Information sent from a form with the POST method is invisible to others and

has no limits on the amount of information to send.

Example

<form action="welcome.php" method="post">

Name: <input type="text" name="fname" />

Age: <input type="text" name="age" />

<input type="submit" />

</form>

 The "welcome.php" file can now use the $_POST variable to collect form data

(the names of the form fields will automatically be the keys in the $_POST

array):

Welcome <?php echo $_POST["fname"]; ?>!<br />

 You are <?php echo $_POST["age"]; ?> years old.

Shipra Goyal (21101185)

7/27/2019 php report.doc

http://slidepdf.com/reader/full/php-reportdoc 33/37

Seven Wonder

PHP Form Handling

 The most important thing to notice when dealing with HTML forms and PHP is

that any form element in an HTML page will automatically be available

to your PHP scripts.

Example

 The example below contains an HTML form with two input fields and a

submit button:

<html>

<body>

<form action="welcome.php" method="post">

Name: <input type="text" name="fname" />

Age: <input type="text" name="age" />

<input type="submit" />

</form>

</body>

</html>

Shipra Goyal (21101185)

7/27/2019 php report.doc

http://slidepdf.com/reader/full/php-reportdoc 34/37

Seven Wonder

When a user fills out the form above and clicks on the submit button, the

form data is sent to a PHP file, called "welcome.php":

"welcome.php" looks like this:

<html>

<body>

Welcome <?php echo $_POST["fname"]; ?>!<br />

 You are <?php echo $_POST["age"]; ?> years old.

</body>

</html>

Output could be something like this:

Welcome John!

 You are 28 years old.

Shipra Goyal (21101185)

7/27/2019 php report.doc

http://slidepdf.com/reader/full/php-reportdoc 35/37

Seven Wonder

Shipra Goyal (21101185)

7/27/2019 php report.doc

http://slidepdf.com/reader/full/php-reportdoc 36/37

Seven Wonder

Shipra Goyal (21101185)

7/27/2019 php report.doc

http://slidepdf.com/reader/full/php-reportdoc 37/37

Seven Wonder

Latest technology updates by Rising heights

 The company will introduce a new search engine in the month of September

(which is Search engine optimization.

 The company is making a social networking website on the name of leafknot

which is already in progress.

Rising heights is also making Ecommerce website very soon for online

shopping. We want to make sure that people can buy all the latest products

online.

We are making a good team of More php developers and some seo people so

there are good chances for candidates to apply for job very soon.