You are on page 1of 56

HTML, PHP & MySQL

A
Industrial Training Report
Submitted in partial fulfillment of the requirement for the award of Degree of
B.Com(Computer Application)
BARKATULLAH UNIVERSITY
BHOPAL (M.P)

Submitted By
Shubham Chouskey
14150901

Department Of Computer Application


M K Ponda College of Business an Management
Bhopal. March-April (2016)

Certificate
Date:16/03/2016
Place:Bhopal

TO WHOM SO EVER IT MAY CONCERN

This is to certify that Subham Chouskey has completed the Industrial Training in
our Organization Cybercops Info Solution, Bhopal (M.P.) during the academic
year 2014-2015. He/she was trained in the field of X-HTML, PHP & MY SQL.
His overall performance during the period was good. We wish him great success in
future.

(IT Manager)
Cyber cops Info Solution, Bhopal

DECLARATION

I Anand Dangi Son of Mr.Umed Singh


Dangi certify
that the internship report
entitled
. Website development repaired by
me is my personal and an authentic work under the
guidance of Mr.Ranjeet kumar(IT Manager) of
Cyber Cops Info Solution,Bhopal.

Date:Signature of student
Place:-Bhopal

Name:-

ANAND DANGI
Class:B.com 6th Sem(CA)
Address:-Pooja Colony
Karond (Bhopal)
Contact No.:9644588232

ACKNOWLEDGEMENT

Before, we get into the depth of the things we would like to add heartfelt words for the
people who at various stages of the project development helped us by their valuable
guidance.
We take this opportunity to express our deep sense of gratitude and indebtedness to
Ms Rajinder kaur, Computer Science Department of our college, for his continuous
guidance, support and encouragement throughout the course of this entire project.
This diction is nothing to acknowledge the constant inspiration encouragement and
guided by Mr Ranjeet Kumar, the project guide, [M K Ponda College of Business
and Management, Bhopal], Bhopal for empowering us to complete our project. It was
only due to their sincere effort that we were able to end up this project.
Also a special thanks to all other staff members and colleagues for their help and
suggestion, which they have always towards us whenever we were in trouble.
Last but not the least we would like to express our gratitude to our parents without
whose help and blessings we cant take a single step in the right direction.

Thanks!

INDEX

S.
no.
1

Content

A glance of Internship
Detail
Internship Schedule

About the organization

Area of internship

Internship Activities

An assessment of the
Internship

Conclusion

References

Page

A glance at internship Detail


Name of student
Permanent Address
Address for correspondence
Contact No.
Student Email Address
Organization Name
Organization Address

: Shubham chouksey
: chandpur Gandhi nagar (Bhopal)
: chandpur Gandhi nagar (Bhopal)
: 7898224959
: schouksey726@gmail.com
: cybercops private limited
: C-25, First Floor, indrapuri, Bhopal
(M.P.)

Organization contact No.


Organization website
Name of instructor
Area of internship
Internship duration
Completion Date

: 0755 409 3399


: : www.cybercopsinfosolution.com
: Mr.Ranjeet kumar
: web Designing
:5 jan.2016
:19 feb.2016

Number of internship days

: 45 days

INTERNSHIP SCHEDULE
S.NO.
`FIRST WEEK

CONTENT
Introduction to HTML

SECOND WEEK HTML paragraph tag<p>,


THIRD WEEK

Horizontal rule tag<hr>


Comments and Marquee tag
HTML styling tag, HTML CSS
HTML Text formatting, HTML Links
,HTML Table

FOURTH WEEK HTML List, HTML Form


HTML Div Tag
HTML Image Tag

FEFTH WEEK

Introduction to PHP
PHP Variables
Decision making
Echo

SIXTH WEEK

Cookies, Session
GET & POST Method
Introduction to My SQL
My SQL Table, Insert Query

SEVENTH

WEEK

Delete Query

About the Organization

COMPANY PROFILE
Our Vision
To be a leading Information Technology Solutions and Training provider in the region
by deploying emerging and advanced technologies through our most valuable assets our people, with continuous commitment to quality and total customer satisfaction,
while contributing towards the organizational as well as societal goals and enhancing
shareholder value.
About Cybercops
Cybercops Info Solution is a team of dedicated professionals who always strive to
make sure that students and professionals coming for the training get the best of the
facilities while they are training in Cybercops Info Solution.
Network Consultancy projects help the students working in live projects and helps us
in getting our students placed in different companies.

Cybercops Info Solution offers a wide range of Networking Courses and Trainings
from top Computer Programming and Networking companies such as Oracle, Cisco
Systems, Microsoft, Linux, CheckPoint, etc to help students and Professionals to
develop a deep understanding into the workings of software development and
Internetworks and also helping them successfully passing Networking industry's
leading Certifications like OCJP,PHP Certification, .net Certification, CCIE, CCNP,
CCNA,CSPFA, CCSP, MCITP, MCSE, RHCE, RHCSS,CEH,CISA,CISSP and many
more.
At Cybercops Info Solution the students are very well guided and recommended for the
best program for their successful career growth.

Company Website: www.cybercopsinfosolution.com


Company address: C-25, First Floor, indrapuri, Bhopal (M.P.)

Area of internship
WEB SITE

A Web site is a related collection of World Wide Web (WWW) files that
includes a beginning file called a home page. A company or an
individual tells you how to get to their Web site by giving you the
address of their home page. From the home page, you can get to all
the other pages on their site. For example, the Web site for IBM has
the home page address of http://www.ibm.com. (The home page
address actually includes a specific file name like index.html but, as
in IBM's case, when a standard default name is set up, users don't
have to enter the file name.) IBM's home page address leads to
thousands of pages. (But a Web site can also be just a few pages.)

TWO TYPES OF WEBSITES1.Static website


A static website is one that has web pages stored on the server in
the format that is sent to a client web browser. It is primarily coded in
Hypertext Markup Language (HTML); Cascading Style Sheets (CSS)
are used to control appearance beyond basic HTML. Images are
commonly used to effect the desired appearance and as part of the
main content. Audio or video might also be considered "static"
content if it plays automatically or is generally non-interactive.

2.Dynamic website

A dynamic website is one that changes or customizes itself


frequently and automatically. Server-side dynamic pages are
generated "on the fly" by computer code that produces the HTML
(CSS are responsible for appearance and thus, are static files). There
are a wide range of software systems, such as CGI, Java Servest and
Java Server Pages (JSP), Active Server Pages and ColdFusion (CFML)
that are available to generate dynamic web systems and dynamic
sites. Various web application frameworks and web template systems

are available for general-use programming languages like Perl, PHP,


Python and Ruby to make it faster and easier to create complex
dynamic web sites.

INTRODUCTION OF HTML
Building Static Sites through HTML
HTML is a computer language devised to allow website creation.
These websites can then be viewed by anyone else connected to the
Internet. It is relatively easy to learn; and quite powerful in what it
allows you to create. It is constantly undergoing revision and
evolution to meet the demands and requirements of the growing
Internet audience under the direction of the W3C, the organization
charged with designing and maintaining the language.
The definition of HTML is Hyper Text Markup Language.
Hypertext is the method by which you move around on the web by
clicking on special text called hyperlinks which bring you to the next
page. The fact that it is hyper just means it is not linear i.e. you
can go to any place on the Internet whenever you want by clicking
on links there is no set order to do things in.
Markup is what HTML tags do to the text inside them.
They mark it as a certain type of text (italicized text, for example).
HTML is a Language, as it has code-words and syntax like
any other language.
HTML is a language for describing web pages.

HTML stands for Hyper Text Markup Language


HTML is not a programming language, it is a markup language
A markup language is a set of markup tags
HTML uses markup tags to describe web pages

What are HTML Tags?


The tags are what separate normal text from HTML
code. You might know them as the words between the <anglebrackets>. They allow all the cool stuff like images and tables and

stuff, just by telling your browser what to render on the page.


Different tags will perform different functions. The tags themselves
dont appear when you view your page through a browser, but their
effects do. The simplest tags do nothing more than apply formatting
to some text, like this:
<b>these words will be bold</b>, and these will not.

INTRODUCTION OF PHP
PHP - What is it?
Taken directly from PHP's home, PHP.net, "PHP is an HTML-embedded
scripting language. Much of its syntax is borrowed from C, Java and
Perl with a couple of unique PHP-specific features thrown in. The goal
of the language is to allow web developers to write dynamically
generated pages quickly." This is generally a good definition of PHP.
However, it does contain a lot of terms you may not be used to.
Another way to think of PHP is a powerful, behind the scenes
scripting language that your visitors won't see!

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

What is a PHP File?

PHP files can contain text, HTML, CSS, JavaScript, and PHP code

PHP code are executed on the server, and the result is returned to the
browser as plain HTML

PHP files have extension ".php"

Why PHP?

PHP runs on various platforms (Windows, Linux, Unix, Mac OS X, etc.)

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

PHP supports a wide range of databases

PHP is free. Download it from the official PHP resource: www.php.net

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

PHP - What's it do?


It is
PHP

also helpful to think of PHP in terms of what it can do for you.


will allow you to:
Reduce the time to create large websites.
Create a customized user experience for visitors based on
information that you have gathered from them.
Open up thousands of possibilities for online tools. Check out
PHP - HotScripts for examples of the great things that are
possible with PHP
Allow creation of shopping carts for e-commerce websites.

PHP Syntax
Before we talk about PHP's syntax, let us first define what syntax is
referring to.
Syntax - The rules that must be followed to write properly structured
code.
PHP's syntax and semantics are similar to most
other programming languages (C, Java, Perl) with the addition that all
PHP code is contained with a tag, of sorts. All PHP code must be
contained within the following...

INTRODUTION OF MY SQL
My SQL is currently the most popular open source
database server in existence. On top of that, it is very commonly
used in conjunction with PHP scripts to create powerful and dynamic
server-side applications.
What is a database?

A database is a structure that comes in two


flavors: a flat database and a relational database. A relational
database is much more oriented to the human mind and is often
preferred over the gabble-de-gook flat database that are just stored
on hard drives like a text file. My SQL is a relational database.
Why use a Database?
Databases are most useful when it comes to storing
information that fits into logical categories. For example, say that you
wanted to store information of all the employees in a company. With
a database you can group different parts of your business into
separate tables to help store your information logically.

My SQL connect
Before you can do anything with My SQL in PHP you
must first establish a connection to your web host's My SQL
database. This is done with the My SQL connect function.
mysql_connect()
Syntax
mysql_connect("server", "user", "password")

INTERNSHIP ACTIVITIES
HTML
HTML markup tags are usually called HTML tags
-HTML tags are keywords 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
-Start and end tags are also called opening tags and closing tags
Getting Started with HTML
What you need?
HTML is written simply in a plain text editor like
Notepad. Advanced developers also use softwares like Frontpage,
Expression Web & Dreamweaver. But we will be using advanced text
editor Notepad++. How to Save HTML Web Page. HTM or HTML

Extension ?When you save an HTML file, you can use either the
.htm or the .html extension. We use .htm in our examples.
With new software it is perfectly safe to use .html
Understand the HTML Web Page Structure.
<html>
<body>Hello,
How are you.
</body>
</html>
Example Explained
The text between <html> and </html> describes the web page
The text between <body> and </body> is the visible page
content
This is the common structure of all the HTML Web Pages.
Always you have to Start the HTML Page with opening HTML and
Body Tags <html> and <body> and after putting all the content you
need in the Web Page, You need to close the opened tags by
</body> and </html>, in the order they were opened.
HTML Elements.
An HTML element is everything from the start tag to the end tag.
Illustration
<p>This is Some Content.</p>
Illustration Explained
Here everything for start paragraph tag to end tag is the HTML
Element. The content between the tags This is Some Content. is
known as the element content.
HTML Element Syntax
An HTML element starts with a start tag / opening tag.
An HTML element ends with an end tag / closing tag.
The element content is everything between the start and the
end tag.

Some HTML elements have empty content.


Empty elements are closed in the start tag.
Most HTML elements can have attributes.
HTML Basic Tags Explained. Heading Tags
There are six levels of headings in HTML specified by <H1>,
<H2>, <H3>, <H4>, <H5> and <H6>tags. <h1> defines the largest
heading
and
<h6>
defines
the
smallest
heading.

Paragraph Tag Illustration Explained


HTML Paragraph element are defined with the <p> tags.
Always remember to close the paragraph tag when a particular
paragraph is written completely.
Illustration
<html>
<body>
<a href="http://www.cybercopsinfosolution.com">Cybercops
Solution Home Page.</a>
</body></html>

Info

Illustration Output
Cybercops Info Solution Home Page.
Some other Useful Tags.
We will now discuss some other useful tags like HTML Rules, HTML
Comments, Line Breaks etc.
Drawing HTML Rules
<HR> (Horizontal Rule) is a stand alone tag that generates a
horizontal line. There is no corresponding HTML command for a
vertical line.
Illustration
<html>
<body>
<h1>My First Heading.</h1>
<hr>
<h2>My Second Heading.</h2>
</body>
</html>
Illustration Output.

Rules Tag Illustration Explained


The <hr> Tag generates a horizontal line between the 2 Headings.
HTML Comments

All combinations of text placed within the comment tags will be ignored by the web
browser, this includes any HTML tags, scripting language(s), etc. Comment tags <!-and --> are used to insert comments in HTML.
Example
<!-- Write your comments here -->
Line Breaks
To break the line and move to the next line. Use the <br> tag.
Marquee
An HTML marquee is a scrolling piece of text displayed either horizontally across or
vertically down your webpage depending on the settings. This is created by using
HTML <marquees> tag.

<!DOCTYPE html>
<html>
<head>
<title>HTML marquee Tag</title>
</head>
<body>
<marquee>This is basic example of marquee</marquee>
<marquee direction="up">The direction of text will be from bottom
to top.</marquee>
</body>
</html>
HTML Styling Tags
You may want to change the way the generated
HTML output looks. The best way to do that is with a Cascading Style
Sheet (CSS), which modern browsers support. Font family, type size,
colors, and other styles can be controlled with CSS for each kind of
element.
Connect CSS to a Webpage

Insert the link of CSS Files into the HTML file. The link is to be put in
the <HEAD> element.
Illustration
<link rel="stylesheet" href="stylesheet.css" type="text/css">

Illustration Explained
The above tag, links the CSS file named
stylesheet.css to the current Web page.
Styling HTML with CSS
CSS stands for Cascading Style Sheets
Styling can be added to HTML elements in 3 ways:
Inline - using a style attribute in HTML elements
Internal - using a <style> element in the HTML <head>
section
External - using one or more external CSS files
CSS Syntax
element { property:value; property:value }
Inline Styling (Inline CSS)
Inline styling is useful for applying a unique style to a single HTML
element:
Inline styling uses the style attribute.
This inline styling changes the text color of a single heading:
Example
<h1 style="color:blue">This is a Blue Heading</h1>
Internal Styling (Internal CSS)

An internal style sheet can be used to define a common style for all HTML elements
on a page.
Internal styling is defined in the <head> section of an HTML page, using
a <style> element:

<!DOCTYPE html>
<html>
<head>
<style>
body {background-color:lightgrey}
h1 {color:blue}
p {color:green}
</style>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
External Styling (External CSS)
External style sheet are ideal when the style is applied to many
pages.
With external style sheets, you can change the look of an entire web
site by changing one file.
External styles are defined in an external CSS file, and then linked
to in the <head> section of an HTML page:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="styles.css">
</head>

<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
Text Formatting
HTML also defines special elements, for defining text with
a special meaning.
HTML uses elements like <b> and <i> for formatting output,
like bold or italic text.
Formatting elements were designed to display special types of text:

Bold text

Important text

Italic text

Emphasized text

Marked text

Small text

Deleted text

Inserted text

Subscripts

Superscripts

HTML Links
HTML links are useful to interconnected the HTML pages.Links
are found in nearly all web pages. Links allow users to click their way
from page to page.
HTML links are hyperlinks.

A hyperlink is a text or an image you can click on, and jump to


another document.
In HTML, links are defined with the <a> tag:

Syntax
<a href="url">link text</a>
Example
<a href="http://cybercopsinfosolutions">Visit our HTML tutorial</a>
HTML Table Tags
The <table> tag defines an HTML table. A simple
HTML table consists of the table element and one or more tr, th, and
td elements. The tr element defines a table row, the th element
defines a table header, and the td element defines a table cell.

Example
<!DOCTYPE html>
<html>
<body>

<table border="1" style="width:100%">


<tr>
<td>Jill</td>
<td>Smith</td>
<td>50</td>

</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
<tr>
<td>John</td>
<td>Doe</td>
<td>80</td>
</tr>
</table>

</body>
</html>
Illustration Output.

HTML List Tags


Words or phrases which need to be set apart from the rest of the
body of text can be emphasized with a bullet.
List Tag
<LI>: creates a bullet in front of text which is to be set apart for
emphasis and causes all text after it to be indented, either until

another list tag is detected or until the end of the list is reached. It is
used to itemize elements of unordered and ordered lists.
Unordered List
An unordered list is a list of items. The list items are marked with
bullets (typically small black circles).
An unordered list starts with the <ul> tag. Each list item starts with
the <li> tag.
Illustration
<html>
<body>
<ul><li>January</li>
<li>February</li>
</ul>
</body>
</html>
Illustration Output

Unordered List Illustration Explained


January & February are put in Bullet as they are inside
an <ul> unordered list tags.
Ordered List
An ordered list is also a list of items. The list items are marked with
numbers. An ordered list starts with the <ol> tag. Each list item
starts with the <li> tag.
Illustration

<html>
<body>
<ol><li>January</li>
<li>February</li>
</ol>
</body>
</html>
Illustration Output

Designing HTML Forms


A form is an area that can contain form elements. Form elements are
elements that allow the user to enter information (like text fields,
textarea fields, drop-down menus, radio buttons, checkboxes, etc.) in
a form. A form is defined with the <form> tag.
<!DOCTYPE html>
<html>
<body>

<form action="action_page.php">
First name:<br>
<input type="text" name="firstname" value="Mickey">
<br>
Last name:<br>
<input type="text" name="lastname" value="Mouse">

<br><br>
<input type="submit" value="Submit">
</form>

<p>If you click the "Submit" button, the form-data will be sent to a
page called "action_page.php".</p>

</body>
</html>
Illustration Output

Textfield
Text fields are used when you want the user to type letters, numbers,
etc. in a form.

Raadio Button
Radio Buttons are used when you want the user to select one of a
limited number of choices.

Checkbox
Checkboxes are used when you want the user to select one or more
options of a limited number of choices.

Block-level Elements
A block-level element always starts on a new line and takes up the
full width available (stretches out to the left and right as far as it
can).
Examples of block-level elements:
<div>
<h1> - <h6>
<p>
<form>
Inline Elements
An inline element does not start on a new line and only takes up as
much width as necessary.
This is an inline <span> element inside a paragraph.
What are <div> Tags
The <div> tag in XHTML is a tag that defines logical
divisions within the content of a page. What this means is that a
<div> tag defines sections of a Web page to make it easier to
manage, style, and manipulate.

<div id=first>Hello There</div>


Example
<div class="outer-div">
This div tag
<div class="inner-div">
contains this div tag.
</div>
</div>

Illustration Output

<div> Tag Illustration Explained


We can then give any design or position to the easily to the <div>
using the CSS.
HTML Images
In HTML, images are defined with the <img> tag.
The <img> tag is empty, it contains attributes only, and does not
have a closing tag.
The src attribute specifies the URL (web address) of the image:
<img src="url" alt="some text">
The alt Attribute
The alt attribute specifies an alternate text for an image, if
the image cannot be displayed.

The alt attribute provides alternative information for an image if a


user for some reason cannot view it (because of slow connection, an
error in the src attribute, or if the user uses a screen reader).
<img src="image.gif" alt="HTML5
Icon" style="width:128px;height:128px;">
PHP Code
<?php
?>
or the shorthand PHP tag that requires shorthand support to be
enabled
on your server...
<?
How to Save PHP Pages?
If you have PHP inserted into your HTML and want the web browser
to interpret it correctly, then you must save the file with a .php
extension, instead of the standard .html extension. So be sure to
check that you are saving your files correctly.
PHP Code
<html>
<head>
<title>My First PHP Page</title>
</head>
<body>
<?php
echo "Hello World!"; ?>
</body>

</html>Display
Hello World!

White Space
As with HTML, whitespace is ignored between PHP statements. This
means it is OK to have one line of PHP code, then 20 lines of blank
space before the next line of PHP code. You can also press tab to
indent your code .

PHP (Hypertext Preprocessor.)


PHP Code
<html>
<head>
<title>My First PHP Page</title>
</head>
<body>
<?php
echo "Hello World!";
echo "Hello World!"; ?>
</body>
</html>
Display
Hello World! Hello World!
PHP Variables
A variable is a means of storing a value, such as
text string "Hello World!" or the integer value 4. A variable can then

be reused throughout your code, instead of having to type out the


actual value over and over again.
In PHP you define a variable with the following
form:
$variable_name = Value;
If you forget that dollar sign at the beginning, it will not work. This is
a common mistake for new PHP programmers!
PHP Variable Naming Conventions
There are a few rules that you need to follow when choosing a name
for your PHP variables.
- PHP variables must start with a letter or underscore "_".
- PHP variables may only be comprised of alpha-numeric characters
and underscores. a-z, A-Z, 0-9, or
- Variables with more than one word should be separated with
underscores. $my_variable
- Variables with more than one word can also be distinguished with
capitalization. $myVariable
PHP Decision Making
Decision making statement in PHP are used to take some
decision the PHP script.
Sometime it is required to perform some task based on condition at
that time decision making statements are used.
Decision making statements allow you to control execution of certain
part of the code based on the outcome of the condition at run time.
PHP supports following decision making statements:

Simple If Statement
Ifelse Statement
Nested If statement
Ifelseif Ladder
SwitchCase Statement

if...else statement use this statement if you want to


execute a set of code when a condition is true and another if
the condition is not true
elseif statement is used with the if...else statement to
execute a set of code if one of the several condition is true
switch statement is used if you want to select one of many
blocks of code to be executed, use the Switch statement. The
switch statement is used to avoid long blocks of if..elseif..else
code.

PHP Echo
As you saw in the previous lesson, the PHP function echo is a means
of outputting text to the web browser. Throughout your PHP career
you will be using the echo function more than any other. So let's give
it a solid perusal!

Outputting a String
To output a string, like we have done in previous lessons, use the PHP
echo function. You can place either a string variable or you can use
quotes, like we do below, to create a string that the echo function will
output.
PHP Code
<?php
$my String = "Hello!";
echo $my String;
echo "<h5>I love using PHP!</h5>";
?>
Display
Hello!
I love using PHP!
Careful When Echoing Quotes!
It is pretty cool that you can output HTML with PHP. However, you
must be careful when using HTML code or any other string that
includes quotes! The echo function uses quotes to define the
beginning and end of the string, so you must use one of the following
tactics if your string contains quotations:
Don't use quotes inside your string
Escape your quotes that are within the string with a slash. To escape
a quote just place a slash directly before the quotation mark, i.e. \"
Use single quotes (apostrophes) for quotes inside your string.
See our example below for the right and wrong use of the echo
function:

PHP Code
<?php
// This won't work because of the quotes around specialH5!
echo "<h5 class="specialH5">I love using PHP!</h5>";
// OK because we escaped the quotes!
Echo "<h5 class=\"specialH5\">I love using PHP!</h5>";
// OK because we used an apostrophe '
Echo "<h5 class='specialH5'>I love using PHP!</h5>";
?>
PHP Strings
In the last lesson, PHP Echo, we used strings a bit, but didn't talk
about them in depth. Throughout your PHP career you will be using
strings a great deal, so it is important to have a basic understanding
of PHP strings.
Illustration
<?php
$variable = "name";
$literally = 'My $variable will not print!\\n';

print($literally);
print "<br />";

$literally = "My $variable will print!\\n";

print($literally);

?>
Illustration Output

PHP - String Creation


Before you can use a string you have to create it! A string can be
used directly in a function or it can be stored in a variable.
Cookies
PHP transparently supports HTTP cookies. Cookies are a mechanism
for storing data in the remote browser and thus tracking or
identifying return users. You can set cookies using the setcookie()
or setrawcookie() function.
Cookies are text files stored on the client computer and they are
kept of use tracking purpose. PHP transparently supports HTTP
cookies.
There are three steps involved in identifying returning users
Server script sends a set of cookies to the browser. For example
name, age, or identification number etc.
Browser stores this information on local machine for future use.
When next time browser sends any request to web server then
it sends those cookies information to the server and server uses
that information to identify the user.
Setcookie(name,value,expire,path,domain,security);
Here is the detail of all the arguments

Name This sets the name of the cookie and is stored in an


environment variable called HTTP_COOKIE_VARS. This variable
is used while accessing cookies.
Value This sets the value of the named variable and is the
content that you actually want to store.
Expiry This specify a future time in seconds since 00:00:00
GMT on 1st Jan 1970. After this time cookie will become
inaccessible. If this parameter is not set then cookie will
automatically expire when the Web Browser is closed.
Path This specifies the directories for which the cookie is
valid. A single forward slash character permits the cookie to be
valid for all directories.
Domain This can be used to specify the domain name in very
large domains and must contain at least two periods to be
valid. All cookies are only valid for the host and domain which
created them.
Security This can be set to 1 to specify that the cookie
should only be sent by secure transmission using HTTPS
otherwise set to 0 which mean cookie can be sent by regular
HTTP.
PHP- Sessions
An alternative way to make data accessible across the various pages
of an entire website is to use a PHP Session.

A session creates a file in a temporary directory on the server


where registered session variables and their values are stored.
This data will be available to all pages on the site during that
visit.
Starting a PHP Sessions
A PHP session is easily started by making a call to the session_start()
function.
This function first checks if a session is already started and if none
is started then it starts one. It is recommended to put the call to
session_start() at the beginning of the page.
<?php
session_start();
if(isset( $_SESSION['counter']))
{
$_SESSION['counter']+=1;
}
else
{
$_SESSION['counter']=1;
}
$msg="You have visited this page ". $_SESSION['counter'];
$msg.="in this session.";
?>
<html>
<head>

<title>Setting up a PHP session</title>


</head>
<body>
<?php echo ( $msg);?>
</body>
</html>
Output
You have visited this page 1in this session.

PHP - GET & POST Methods


While dealing with the forms, information can be submitted and
transferred to same or another page. To send submitted data through
form, one can use GET & POST method to do that in PHP.
A form data can be submitted using these two methods. Both are
used for same purpose but stands apart under some specifications.
As in GET method key values are passed in the Url while in POST, the
information transfers in a hidden manner.
GET Method
As explained above, before sending any information , it converts
values/data into a query string in URL known as Url Encoding. Which
contains both page link and encoded information separated by
the ? character.

<?php
if( $_GET["name"]|| $_GET["age"])
{
echo"Welcome ". $_GET['name']."<br />";
echo"You are ". $_GET['age']." years old.";
exit();
}
?>
<html>
<body>
<form action="<?php$_PHP_SELF?>" method="GET">
Name: <inputtype="text"name="name"/>
Age: <inputtype="text"name="age"/>
<inputtype="submit"/>
</form>
</body>
</html>
Output
Name: Age:

POST Method
As explained above, before sending information to
server, it converts clients information into a query string in URL.
<?php
if( $_POST["name"]|| $_POST["age"])

{
if(preg_match("/[^A-Za-z'-]/",$_POST['name']))
{
die("invalid name and name should be alpha");
}
echo"Welcome ". $_POST['name']."<br/>";
echo"You are ". $_POST['age']." years old.";
exit();
}
?>
<html>
<body>
<form action="<?php$_PHP_SELF?>" method="POST">
Name: <inputtype="text"name="name"/>
Age: <inputtype="text"name="age"/>
<inputtype="submit"/>
</form>
</body>
</html>
Output
Name: Age:

PHP & MySQL Code:


<?php

mysql_connect("localhost", "admin", "1admin") or die(mysql_error());


echo "Connected to MySQL<br />";
?>
Display:
Connected to MySQL
Choosing the working Database
After establishing a MySQL connection with the code
above, you then need to choose which database you will be using
with this connection. This is done with the mysql_select_db function.
MySQL Tables
A MySQL table is completely different than the normal table that you
eat dinner on. In MySQL and other database systems, the goal is to
store information in an orderly fashion.
PHP & MySQL Code:
<?php
// Make a MySQL Connection
mysql_connect("localhost", "admin", "1admin") or die(mysql_error());
mysql_select_db("test") or die(mysql_error());
// Insert a row of information into the table "example"
mysql_query("INSERT INTO example
(name, age) VALUES('Timmy Mellowman', '23' ) ")
or die(mysql_error());
mysql_query("INSERT INTO example
(name, age) VALUES('Sandy Smith', '21' ) ")
or die(mysql_error());

mysql_query("INSERT INTO example


(name, age) VALUES('Bobby Wallace', '15' ) ")
or die(mysql_error());
echo "Data Inserted!";?>
Display:
Data Inserted!
Mysql_fetch_array: why use it?
Do you know what is returned when you used the mysql_query
function to query a MySQL database? It isn't something you can
directly manipulate, that is for sure. Here is a sample SELECT query
of a table we created in the MySQL Create Table lesson.
PHP and My SQL Code:
<?php
$result = mysql_query("SELECT * FROM example");
?>
The value that mysql_query returns and stores into
$result is a special type of data; it is a My SQL Resource. Additional
PHP functions are required to extract the data from this Resource.

MYSQL
MySQL Delete
Maintenance is a very common task that is
necessary for keeping MySQL tables current. From time to time, you
may even need to delete items from your database. Some potential
reasons for deleting a record from MySQL include when: someone
deletes a post from a forum, an employee leaves a company, or
you're trying to destroy your records before the federalies come!
MySQL delete example

The DELETE query is very similar to the UPDATE


Query in the previous lesson. We need to choose a table, tell MySQL
to perform the deletion, and provide the requirements that a record
must have for it to be deleted.

PHP & MySQL Code:


<?php
// Connect to My SQL
// Delete Bobby from the "example" My SQL table
mysql_query("DELETE FROM example WHERE age='15'")
or die(mysql_error());
?>
It is important to note that this query would have
deleted ALL records that had an age of 15. Since Bobby was the only
15 year old this was not a problem.
MySQL Delete Tips
Before performing a large delete on a database, be sure to back up
the table/database in case your script takes off a little more than
desired. Test your delete queries before even thinking about using
them on your table. As long as you take caution when using this
powerful query you should not run into any problems.

1.

AN ASSESSMENT OF THE INTERNSHIP

FIRST PAGE

SECOND PAGE

THIRD PAGE

FOURTH PAGE

FIFTH PAGE

SIXTH PAGE

CONCLUSION

Web technology has been growing day by day so as networking. The


scope in website development has been increasing more in IT field.
Today almost every organization is using website and some through
many networking problem. Website development is a challenging task
for me but working under guidance of my instructor Mr.Ranjeet kumar
sir made me work at easy. Working under his guidance have made
confident over my subject (website designing) and made me capable
of solving basic programming problems. After all these experiences
which I got my angel software, I am looking forward to continue my
career in the field of website development.

Bibliography
1)

2)

.C Xaviers HTML
,Tata McGraw-Hill
Education, 01-Apr2000

2)Black book ,
publication,
year,place

3)

References
1. 1.
2. www.w3schools.com/html/
3. https://en.wikipedia.org/wiki/PHP
4.http://websource.net/html_codes_chart.htm#italic
5.http://www.quackit.com/html/codes/
6.http://www.2createawebsites.com/create-awebsite-html.php

You might also like