Wednesday, 29 July 2015

HTML URL Encode Tutorial

URL Encoding is the process of converting string into valid URL format.URL stand for Uniform Resource Locator. Through URL web browsers request pages from web servers.

When you click on a link in an HTML page, an underlying  a tag points to an address on the world wide web. A Uniform Resource Locator is employed to address a document on the world wide web. html url Encode Tutorial encoding is the practice of translating unprintable characters or characters with special meaning within URLs. Various characters are:

ASCII characters:  Unprintable characters usually employed for output control. Character ranges 00-1F hex (0-31 decimal) and 7F (127 decimal).

Non-ASCII characters – These are characters beyond the ASCII character set of 128 characters. This range is part of the ISO-Latin character set and includes the whole “top half” of the ISO-Latin set 80-FF hex (128-255 decimal).

The URL should only be sent over the Internet using the ASCII character-set.Since URLs often contain characters outside the ASCII set, the URL has to be converted into a valid ASCII format.Then URL encoding automatically convert the characters into a format that can be transmitted over the Internet.

The html url encoding use the “%” to replaces the non ASCII characters followed by two hexadecimal digits. The URLs should not contain spaces. The + sign is used by the URL encoding to replaces a space.

Scheme Full Form scheme used in…
http Hyper Text Transfer Protocol Generally web pages starts with http://.
https Secure Hyper Text Trasfer Protocol It is use for Secure web pages.
ftp File Transfer Protocol It is used for downloading or uploading files to a website. It is mostly useful for domain maintenance.

PHP sessions

PHP session variable is employed to store the data about,or amendment settings for a user php session tutorial. Session variables hold data concerning one single user, and are available to all pages in one application.
  • In Session variable, session data is temporary and can be deleted when the user has left the web site,If you would like a permanent storage,then you will wish to store the data during  database.

Starting a PHP session:

php session can be started by calling a function called Session_Start( ). The function initially checks if a session is already started and if none is started then it starts one. It is counseled to place the decision to call to session_start() at the start of the page.
  • Session_Start function should appear before the <html> tags.

<?phpsession_start();?><html>
<body>
<p>This is our paragraph</p>
</body>
</html>

Storing a session variable:

We can also store the session variable,see the example below:

<?php
session_start();
// store the session
$_SESSION[‘store’]=9;
?>
<html>
<body><?php
//retrieve session data
echo “Pagestore=”. $_SESSION[‘store’];
?></body>
</html>

Destroy a session variable:

By using unset() function or the session_destroy() function you can delete session data.


<?php
session_destroy();
?>
<html><body><p> This is a paragraph </p>
</body>
</html>

Wednesday, 22 July 2015

HTML5 Introduction Tutorial

About HTML5 :-

The earlier version of HTML was comes in Late 90’s. HTML5 comes recently in the market with some new features and latest technology.The demand of HTML5 increases very fast. The web developer should update there knowledge with the latest technology to survive in the market.
HTML5 is intended to deliver nearly everything you wish to try and do online while not requiring extra plugins. It will everything from animation to apps, music to films, and may even be employed to build sophisticated applications that run in your browser.
HTML5 is a cross platform i.e. you made file on one browser  and run on the different browser.
HTML5 features are not compatible with all the browser.However, major browser almost support this and they are working on it to make HTML5 fully compatible.
As you know with every new technology the rules for that technology is also be developed. So, HTML5 introduction tutorial also has following rules:
  1. The HTML5 ought be device-independent.
  2. It reduced the requirement  for external plugins.
  3. It reduce the difficulty of error handling as compare to previous versions.
  4. The scripting must be get replaced by a lot of markup.
  5. The establishment of new features ought to be supported HTML, CSS and JavaScript.

All New Features of HTML5:-

  • The <audio> and <video> determines a sound content and video for movies.
  • The <aside> determines the content aside from the page content.
  • The <canvas> determines Used to draw graphics, on the fly, via scripting.
  • The <datagrid> determines to set row or colmn grid and split number of individual column grid.
  • The <embed> determines container for an external applications. and lot more features:
For more info go to our HTML5 tag.

PHP Cookies

A Cookie is usually accustomed established a user. A cookie could be a little file that server embeds on the  user’s PC. Each time a  similar PC request a page with a browser,it will send a cookie too. With a PHP, you’ll  each produce and receive cookie’s value.
  • Setcookie( )  function  is used to set cookie.
  • Setcookie() function must appear before the  <html> tag.

Syntax of cookie is:
setcookie(name, values, expiry, path, domain);
We take a example which makes easier to understand this:

HTTP/1.1 200 OK
Date: Fri, 25 Jan 2005 18:15:05 GMT
Set-Cookie:name=joy;expires=Sunday,25-Jan-09 10:33:45 GMT;
path=/; domain=fullyhelp.com

Retrieving a cookie:

PHP $_cookie  variable is used to retrieve a cookie value.

<?php
// Print a cookie
echo $_COOKIE[“joy”];
// The technique is used to view all  cookies
print_r($_COOKIE);
?>

Delete a Cookie:

Deleting a php cookies is very simple process, set the value of the cookie to null, and also set the expire time of the cookie in the past. Ideally, one would set the expiry time to about a year in the past, so that if the system time is off , then the cookie will still delete correctly.

<?php
// set the expiration date to one year ago
setcookie(“name”, “”, time()-365);
?>

Tuesday, 21 July 2015

HTML5 Canvas Tutorial

The canvas is employed to draw graphics using scripting.It is also used to draw graphs, make photo compositions or do simple animations. Almost all the browser support support the html canvas tutorial

You can also create canvas, Basically it is a rectangular area on a HTML page which has attribute like- id, class, width, and height.

Example:

<canvas id=”myCanvas” width=”300″ height=”150″></canvas>

To make a border through canvas use style attributes.

Example:

<!DOCTYPE html>
<html>
<body><canvas id=”myCanvas” width=”300″ height=”150″ style=”border:1px solid #000000;”>
</canvas></body>
</html>

Output: 









Attribute Used:

Attribute Value Description
title text It specifies a title to keep company with the component,several browser can show this once the pointer hovers the component.
id id It defines unique id for an element.
class classname It defines the element class name.
lang URL It Sets the language code.
style style_definition It defines Helps to include inline cascading style sheet.

PHP Files and I/o

Generally, there are 4 types of  I/O files are present in PHP that are as follows: opening , writing, reading, closing a file.

Opening a File:

The fopen() function in php is used to open files. This file require two arguments first one is the file name to be open and the next is that in which mode of the file is open.

Mode Purpose
r It Open the files for reading only and it places the file pointer at the beginning of the file.
r+ It Open the files for both reading and writing.
and it places the pointer at the beginning of the file.
w It Open the files for writing only and it places the file pointer at the beginning of the file. If files does not
exist then it attemts to create a file.
w+ It open the files for both reading and writing only and it
places the pointer at the beginning of the file.If files does not
exist then it attemts to create a file.
a It Open the files for writing only and it
places the pointer at the end of the file.
If files does not exist then it attemts to create a file.
a+ It Open the files for both reading and writing only and it
places the pointer at the end of the file.
If files does not exist then it attemts to create a file.

If  you want to open a file and  fopen() function is unable to open the specified file then it returns false.
We take a example to generate a message if the fopen() function is unable to open the selected file:

<html>
<body><?php
$file=fopen(“Hello World.txt”,”r”) or exit(“Unable to open file!”);
?></body>
</html>

When you completed the changes in the open file, it is important that you must close the php files & i/o with the fclose() function. For  fclose() function it requires a file pointer as its argument and then returns true when the closure succeeds or false if it fails.
  We take a example to generate a message if the fopen() function is unable to open the selected file:

<?php
$file = fopen(“Hello.txt”,”r”);//code to be executedfclose($file);
?>

Reading a file:

Once you open a file with fopen( ) function you can read the file with fread( ) function.The file require two arguments. These must be the file pointer and the length of the file expressed in bytes.
There are various types of function for reading a file:
  • The fgets() function is used to read a single line from a file.
  • The fgetc() function is used to read a single character from a file.

Monday, 20 July 2015

HTML5 SVG Tutorial

SVG  is stand for Scalable Vector Graphics.The SVG is employed to define vector based graphics or diagrams like- pie charts, 2-d graphs etc.SVG is different from raster-based graphics, which store the color definition for each pixel in an array of data. The most common raster-based formats used on the web today are JPEG, GIF, and PNG, and each of these formats has strengths and weaknesses.

Various advantages of SVG are as follows:

  • SVG graphics are created using mathematical formulas that require far less data to be stored in the source file.
  • SVG graphics load faster because the source file size tends to be smaller.
  • SVG images are rendered by the browser and can be drawn programmatically.
  • The graphics of SVG is in XML format.
  • The SVG images can be printed with high quality at any resolution

Syntax of SVG:-

<svg xmlns=”http://fullyhelp.com/tag/wp-content/uploads/2013/11/wheel.png” >
</svg>

Example:

<html>
<body><svg xmlns=”http://fullyhelp.com/tag/wp-content/uploads/2013/11/wheel.png” >
</svg></body>
</html>

SVG  Different from Canvas:

SVG is a language for describing 2D graphics in XML whereas Canvas draws 2D graphics.
In SVG every drawn shape is remembered as an object. If attributes of an html5 SVG tutorial object are modified the browser will automatically re-render the shape.Canvas is rendered pixel by pixel. In canvas once the graphic is drawn it is forgotten by the browser. If its position ought to be modified the complete scene must be redrawn together with any objects that might have been covered by the graphic.

Attribute Value Description
title text It specifies a title to keep company with the component,several browser can show this once the pointer hovers the component.
id id It defines unique id for an element.
class classname It defines the element class name.
lang URL It Sets the language code.
style style_definition It defines Helps to include inline cascading style sheet.

PHP File Inclusion

We can directly include the data of a PHP file into another php file inclusion before the server executes it. There are two PHP functions through which we can be used to include one PHP file into another PHP file.
  •     The include() Function
  •     The require() Function
Basically, both function are the same, both are used to insert useful codes written in other files, in the flow of execution.

 Include() Function:

In include command, include takes a file name and simply inserts that files contents into the script that issued the include command.
Include will only produce warning like (E_WARNING) and script will continue.
Now, suppose you want to create a common menu i.e. menu.php with the following content:

<html>
<body>
<a href=”http://www.fullyhelp.com/index.php”>Home</a> –
<a href=”http://www.fullyhelp.com/php”>PHP</a> –
<a href=”http://fullyhelp.com/c”>C</a> –
<a href=”http://www.fullyhelp.com/css”>CSS</a> <br />

Now create pages that you wanted and include this php file inclusion tutorial to create header. For example your test.php file can have following data.

<html>
<body>
<?php include(“menu.php”); ?>
<p>This is include PHP file!</p>
</body>
</html>

This will display the following output

Home-PHP-C-CSS 

Require() Function

In require function, require will produce a fatal error like(E_compile_ERROR) and it will halt the script. Now we take a above example using require function

<html>
<body>
<?php require(“xxmenu.php”); ?>
<p>This is include wrong PHP file!</p>
</body>
</html>

It will nothing display and stop the script.

Friday, 17 July 2015

HTML5 New Elements Tutorial

The HTML5 is for most better then HTML4.1. HTML5 includes all html new elements like- graphics, audio and visual effects, several APIs and reduce the error handling and lot more features.

Some of the elements  briefly describe below:

The aside element:

It defines some content aside from the content it is placed in, aside content is related to surrounding content.

Example:

<p>My Family going to Jammu and Kashmir this summer</p><aside><h3>Kashmir</h3><p>Kashmir is a beautiful place, also called Heaven. </p></aside>

The canvas element:

This element is used to draw graphics using scripting.It is also used to draw graphs, make photo compositions or do simple animations.

Example:

<canvas id=”myCanvas” width=”150″  height=”150″></canvas>
<script type=”text/javascript”>
var canvas=document.getElementById(‘myCanvas’);
var ctx=canvas.getContext(‘2d’);
ctx.fillStyle=’#000000′;
ctx.fillRect(10,30,0,70);
</script>

The Datagrid element:

This element is employed to set row or colmn grid and split number of individual column grid.

Example:

<datagrid>
<ol style=”list-style-type:decimal”>
<li> (Line 1) </li>
<ol style=”list-style-type:lower-alpha;”>
<li> (Line 1,0) </li>
<li> (Line 1,1) </li>
</ol>
<li> (Line 2)
<ol style=”list-style-type:lower-alpha;”>
<li> (Line 2,1) </li>
<li> (Line 2,2) </li>
</ol>
</li>
</ol>
</datagrid>

The ruby elements:

The ruby tag is employed to indicates a ruby annotation. It display the pronunciation of East Asian characters.

Example:

<ruby>
金<rt>Gold</rt>
銀<rt>Silver</rt>
銅<rt>copper</rt>
碳<rt>carbon</rt>
</ruby>

All other elements given below in table:


HTML 5 tags
Description
<article> It determines article.
<audio> It determines a sound content.
<aside> It determines the content aside from the page content.
<bdi> It indicates Isolates a part of text that might be formatted in a different direction from other text outside it.
<canvas> It determines Used to draw graphics, on the fly, via scripting.
<data> It indicates data of the document.
<datagrid> It determines to set row or colmn grid and split number of individual column grid.
<datalist> It indicates list of pre-defined options for input controls.
<datails> It determines the additional information.
<dialog> It indicates the dialog window of the document.
<embed> It determines container for an external applications.
<figcaption> It indicates the Defines a caption for a <figure> element.
<figure> It determines the self contain content.
<footer> It indicates the footer of the content.
<header> It determines the header of the content.
<hgroup> It indicate the header of an HTML document or section.
<keygen> It determines key-pair generator field.
<main> It indicates the main content.
<math> It determines Helps to include inline cascading style sheet.
<meter> It indicates scalar measurement within a known range.
<menu> It determines the list of commands.
<mark> It display the root of a MathML fragmen.
<nav> It determines the navigation list.
<output> It indicates result of calculation.
<progress> It determines the progress of the task.
<ruby> It indicates ruby annotation.
<rt> It determines the explanation of the character .
<rp> It indicates what to show in the browser if ruby tag is not suported.
<source> It determines multiple media resources for media elements.
<svg> It indicates the scalar video graphics.
<section> It determines the section of the documents.
<summary> It indicates visible heading for a details element.
<time> It determines the date and time.
<track> It indicates text track for media element.
<video> It determines the video or movie.
<wbr> It indicates the possible line-break.                                                                        

PHP Switch

In PHP,the Switch statement is used to perform different actions based on different conditions.The Switch statement works like this, it takes a single variable as input and then checks it against all the different cases that you set up for switch statement. Instead of having to check that variable one at a time, as it goes through many of If Statements, the Switch statement only has to check one time.
Switch Statement example:


Let’s take a example, the single variable will be $company and the cases will be: Honda, Suzuki, Hero, Bajaj.


<?php
$company = “Hero”;
echo “Bikes of $company<br/>”;
switch ($company){
case “Honda”:
echo “its very costly”;
break;
case “Suzuki”:
echo “buy a hayabusa bike”;
break;
case “Hero”:
echo “best reseller product”;
break;
case “Bajaj”:
echo “buy limited bikes”;
break;
}
?>

Thursday, 16 July 2015

HTML5 Drag/Drop Tutorial

Drag and Drop is new in HTML5. This allows the user to click and hold the mouse button down over an element, drag it to different location, and release the button to drop the element there.
A semitransparent illustration of what is being dragged can follow the mouse pointer throughout the drag operation. The drop location is also a different application.

Example:

<!DOCTYPE HTML>
<html>
<head>
<script>
function allowDrop(ev)
{
ev.preventDefault();
}function drag(ev)
{
ev.dataTransfer.setData(“Text”,ev.target.id);
}function drop(ev)
{
ev.preventDefault();
var data=ev.dataTransfer.getData(“Text”);
ev.target.appendChild(document.getElementById(data));
}
</script>
</head>
<body><div id=”div1″ ondrop=”drop(event)”
ondragover=”allowDrop(event)”></div>
<img id=”drag1″ src=”http://fullyhelp.com/html/wp-content/uploads/2013/10/FULLY-HELP.jpg” draggable=”true”
ondragstart=”drag(event)” width=”300″ height=”75″
</body>
</html>

Output:

Drag the image into this box:


Events Description
dragstart It specifies that it fires when the user starts dragging of the object.The user is requesting to drag the element the dragstart event is fired at.During this event a listener would set information such as the drag data and image to be associated with the drag. .
dragenter It defines that fired once the mouse is first moved over an element while a drag is happning. A listener for this event ought to indicate whether a drop is allowed over this location. If there are no listeners, or the listeners perform no operations, then a drop is not allowed by default.
dragover It defines this event is fired as the mouse is moved over an element when a drag is occuring. .
dragleave It defines that the event is fired once the mouse leaves an element whereas a drag is occurring. Listeners ought to remove any highlighting or insertion markers used for drop feedback.
drop It defines that the drop event is fired on the element whereever the drop occurred at the end of the drag operation. A listener would be responsible for retrieving the info being dragged and inserting it at the drop location. This event will only fire if a drop is desired. It will not fire if the user cancelled the drag operation.

PHP Operators

To make it simple for you we take a expression which will make easier to understand, expression 5 * 5 = 25, here 5 and 25 are the operand and *, = are the php operators.
In PHP there are following type are operators:
Arithmetic operators:
Suppose variable A is 10 and variable B is 5 then:

Operator Name Example Result
+ Addition $A + $B Sum of $A and $B is 15
- Subtraction $A – $B Difference of $A and $B is 5
* Multiplication $A * $B Product of $A and $B is 50
/ Division $A / $B Quotient of $A and $B is 0.5
% Modulus $A % $B Remainder of $A divided by $B

Logical Operators:
Suppose we taking above example, variable A is 10 and variable B is 5 then:

Operator Name Example Result
and And $A and $B True if both $A and $B are true
or Or $A or $B True if either $A or $B is true
&& And $A && $B True if both $A or $B is true
|| Or $A || $B True if either $A or $B is true
! Not !$A True if $A is not true

Comparison Operators:
Suppose variable A is 10 and variable B is 5 then:

Operator Name Example Result
== Equal $A == $B True if $A is equal to $B
!= Not equal $A != $B True if $A is not equal to $B
> Greater than $A > $B True if $A is greater than $B
< Less than $A < $B True if $A is less than $B
>= Greater than or equal to $A >= $B True if $A is greater than or equal to $B
<= Less than or equal to $A <= $B True if $A is less than or equal to $B

Assignment Operator:
This operator is used to write the value to a variable.

Operator Name Example
= Equal A=B
+= Addition C= A+B
-= Subtraction C= A-B
*= Multiplication C= A*B
/= Division C= A/B
%= Modulus C= A%B

Conditional Operator:
There is one other kind of php operators tutorial called conditional operator.It is also called ternary operator.It first evaluates an expression for a true or false value and then execute one statement between the two given statements depending upon the result of the evaluation, condition operator woks as follows:
  • The first operand is implicitly converted to bool. It is evaluated and all side effects are completed before continuing.
  • If the first operand evaluates to true, the second operand is evaluated.
  • If the first operand evaluates to false, the third operand is evaluated.
The result of the conditional operator is that result  whichever operand is evaluated.
&nbsp:

Wednesday, 15 July 2015

HTML5 Audio Tutorial

The HTML audio tutorial is employed to defines sound or audio files, such as music or other audio streams. Almost all the major browser use this element. Audio tag is new in HTML5.
To implement the audio you should use audio tag i.e. <audio control> </audio>
Any content between the opening and closing <audio> is fallback content and this content is displayed only by browsers that don’t support the <audio> tag.

Example:

<audio controls>
<source src=”http://fullyhelp.com/tag/wp-content/uploads/2013/11/Maid-with-the-Flaxen-Hair.mp3″ type=”audio/ogg”>
<source src=”http://fullyhelp.com/tag/wp-content/uploads/2013/11/Maid-with-the-Flaxen-Hair.mp3″ type=”audio/mpeg”>
</audio>

Output:

Browser Compatibility:

Browser .mp3 .wave .ogg
Mozzila Firefox 3.6
Opera 10.6
Chrome 8
Safari 5.0

Standard Attributes:


Attribute Value Description
src url It specifies the URL of your audio file
id id It defines unique id for an element.
class classname It defines the element class name.
lang URL It Sets the language code.
control Boolean attribute It defines that you need this to make the native audio player appear. Otherwise, you would have to use DOM to control the audio element to play your music.

PHP String Functions

A  string is sequence of characters, where a character is the same as a byte,hence php support 256 character set.
  •  Split function, split the string function tutorial into an array using regular expression and return the array.
  • Explode function , it is used to split a string using another sting.
 PHP strlen() function:
  •  The strlen() function is used to return the length of a string  in characters.
  • Let’s take a example to find the length of our string “Hello happy!”:
<?phpecho strlen(“Hello happy!”);?>
  • Output will be:
12
Note: The length of a string is used in loop or other php string functions, when it is important to know when the string ends i.e. in a loop, we would want to stop the loop after the last character in the string.

PHP strpos() function:

  • The strpos() function is used to search for a string or specified characters within a string.
  • If a match is found, it will return the character position of the first match. If there is  no match is found, it will return FALSE.
  • Let’s take a example to find a string ” happy!”in our string:

<?php ;echo strlen(“Hello happy!”);    ?>
  • Output will be:
6
Note: The position of a string “happy” in our string is 6 position.The reason that it is 6 position, and not 7 position, is that the first position in the string is 0  not 1.

Saturday, 11 July 2015

HTML5 Video Tutorial

The HTML video defines the video such as a movie clip or other video streams. The html5 video track is new in HTML5. The video tag is supported by almost all the browsers.
To implement the video you should use audio tag i.e. <video control> </video>. Any content between the opening and closing <video> is fallback content and this content is displayed only by browsers that don’t support the <video> tag.

Syntax:

<video src=”wildlife.mp4″ controls width=”480″ height=”360″></video>

Example:

<!DOCTYPE html>
<html>
<body><div style=”text-align:center”>
<button onclick=”makePlay()”>Play</button>
<button onclick=”makeStop()”>Stop</button>
<br>
<video id=”video1″ width=”420″>
<source src=”http://fullyhelp.com/html/wp-content/uploads/2013/11/VID-20130506-WA0000.mp4″ type=”video/mp4″>
<source src=”http://fullyhelp.com/html/wp-content/uploads/2013/11/VID-20130506-WA0000.mp4″ type=”video/ogg”>
</video>
</div><script>
var myVideo=document.getElementById(“video1″);function makeplay()
{
myVideo.width= 300;
}
function makestop()
{
myVideo.width=350;
}
</script>
</body>
</html>

Output:

Play
Stop




Browser Compatibility:

Browser mp4 webM ogg
Mozzila Firefox 3.6
Opera 10.6
Chrome 8.0
Safari 5.0

Standard Attributes:


Attribute Value Description
src url It specifies the URL of your audio file
width pixels It defines the width of video player.
Height pixels It defines the height of the video player.
autoplay Boolean attribute If this exists, the browser will directly play your video without asking permission from visitor.
control Boolean attribute It defines that you need this to make the native audio player appear. Otherwise, you would have to use DOM to control the audio element to play your music.

PHP GET & POST

Difference between PHP GET and POST method?
  • Get display the form values entered in the URL of the address bar where as Post does not do.
  • Get is used to submitted a small amount of data whereas Post is used to submitted large amount of data.
  • Get is used to store less sensitive data on the other hand Post are used to store more sensitive data as compare to php get method.
  • Get method are good for information required for either bookmarking a particular item, or for assisting in search engine optimization and indexing items. php post method is good for standard forms used to submit one time data.
  • Example of Get method shown below:

<?phpif( $_GET[“username”] || $_GET[“email”] ){echo “Welcome “. $_GET[‘username’]. “<br />”;
echo “You are “. $_GET[‘email’].”;
exit();
}
?>
<html>
<body>
<form action=”<?php $_PHP_SELF ?>” method=”GET”>
UserName: <input type=”text” name=”username” />
Email: <input type=”text” name=”email” />
<input type=”submit” />
</form>
</body>
</html>
  • Example of Post method is shown below:


<?phpif( $_POST[“username”] || $_POST[“email”] ){echo “Welcome “. $_POST[user’name’]. “<br />”;
echo “You are “. $_POST[‘email’]. ;
exit();
}
?>
<html>
<body>
<form action=”<?php $_PHP_SELF ?>” method=”POST”>
Name: <input type=”text” name=”username” />
Age: <input type=”text” name=”email” />
<input type=”submit” />
</form>
</body>
</html>

Friday, 10 July 2015

HTML5 input types Tutorial

HTML5 introduces new input types for forms. We are going to take a look at each of them and explain why you should be using them right now.
These new input types of HTML5 have dual benefits: using them means less development time and an improved user experience.These new features allow better input control and validation.
The html5 input types are following:

Search:

Search seems like an appropriate place to start our foray into HTML5 input types.

Example:

<form action=”example_form.php”>
Search:<input type=”search” name=”search”><br>
</form>

Output:

Search:

Range:

The range type is employed for input fields that ought to contain a value from a range of numbers. The range input type is similar to number but more specific. It represents a numerical value within a given range.
The following code shows how we might mark up our skill level on a scale of 0 to 100 by setting the min and max attributes:

Example:

<form action=”example_form.php” method=”get”>
Skills: 0<input type=”range” name=”points” min=”0″ max=”100″>100
</form>

Output:

Points: 0
100

Color:

The color input type is pretty self-explanatory: it allows the user to select a color and returns the hex value for that color.

Example:

<form action=”example_form.php”>
Choose color: <input id=”color” name=”color” type=”color”>
</form>

Output:

Choose color:

Datetime:

We can combine the date and time by using type=”datetime” for specifying a precise time on a given day.

Example:

<form action=”example_form.php”>Date and Time: <input id=”entry-day-time” name=”entry-day-time” type=”datetime”>
</form>

Output:

Date and Time:

Number:

The number type is employed for input fields that ought to contain a  numeric value.

Example:

<form action=”example_form.php”>
Sliper size: <input type=”number” name=”sliper size” min=”4″ max=”11″>
</form>

Output:

Sliper size:

Email:

The email input type is no different than a standard text input type and allows for one or more e-mail addresses to be entered. Combined with the required attribute, the browser is then able to look for patterns to ensure a valid e-mail address has been entered.

Example:

<form action=”example_form.php”>
E-mail: <input type=”email” name=”email”>
</form>

Output:

E-mail:

tel:

The tel type is employed for input fields that tel is differs from email or other html5 input types tutorial in that no particular syntax is enforced.

Example:

<form action=”example_form.php”>
Telephone: <input type=”tel” name=”tel” id=”tel”>
</form>

Output:

Telephone:

URL:

The url type is employed for input fields that ought to contain a URL address.

Example:

<form action=”example_form.php”>
Telephone: <input type=”url” name=”url”>
</form>

Output:

Telephone:

PHP Constants

  • A constant is a identifier or name for a simple value.The value of  php constant do not change during the execution of script.
  • Constant are case sensitve.
  • It became easy to understand after reading this example shown below:

<?define( “SITE”,  “fullyhelp.com”);
define(“AUTHOR”,  “libra”);echo SITE
echo AUTHOR
echo SITE. “by” . AUTHOR
?>

  • If the php canstant tutorial is not case- sensitive , then this statement couldn’d work.see the example:


<?
echo Site;?>
  • If you want to make it case- insesitive, then only you may set a third parameter to true



<?
define( “SITE”,  “fullyhelp.com”);
echo SITE
echo Site?>

Thursday, 9 July 2015

HTML5 Form Elements Tutorial

HTML5 has new form elements. These are following:
  • <wbr>
  • <progress>
  • <bdi>
  • <rubi>
  • <dialog>
  • <meter>

HTML5 <wbr> form element:

The wbr stand for Word Break. The <wbr> tag defines where in a text it would be ok to add a line-break.This tag is employed where a word is too long, or you are afraid that the browser will break your lines at the wrong place, you can use the wbr tag to add word break opportunities. The wbr element support by all the browser except the internet explorer.

Example:

<p>To learn PHP, you must be know about XML<wbr> HTML and CSS.<wbr /></p>

Output:

To learn PHP, you must be know about XML HTML and CSS.

HTML5 <Progress> form element:

The progress element is new in HTML5. The progress  html5 element tutorial describe  the progress of a task. All the major browser support this element except the internet explorer 9 or earlier versions.

Example:

Scanning progress:
<progress value=”81″ max=”100″>
</progress>

Output:

Scanning progress:

HTMl5 <bdi> form element:

Bdi stands for Bi Directional Isolation. It Isolates a section of text, which may be formatted during a completely different direction from alternative text outside it. Bdi tag support two browser only i.e. Firefox and Chrome.

Example:

<p>This Persian word <bdi>DAHSHOG NOOHK </bdi> is automatically displayed right-to-left.</p>

Output:

This Persian word KHOON GOHSHAD is automatically displayed right-to-left.

HTML5 <rubi> form element:

The ruby element is employed to indicates a ruby annotation. It display the pronunciation of East Asian characters. The ruby tag is new in HTML5. Almost all the browser support this tag.

Example:

<ruby>
金<rt>Gold</rt>
銀<rt>Silver</rt>
銅<rt>copper</rt>
碳<rt>carbon</rt>
</ruby>

Output:


金Gold
銀Silver
銅copper
碳carbon

HTML5 dialog form element:

The <dialog> element indicates a dialog between a number of people.The <dialog> tag defines a dialog box, inspector or window.

Example:

<html>
<body>
<dialog>
<dt>Raj:</dt>
<dd>How are you John ?</dd>
<dt>John:</dt>
<dd>I am very well.</dd>
</dialog>
</body>
</html>

Output:

Raj:
How are you John ?
John:
I am very well.

HTML5 <meter> form element:

The meter element is employed to specify a scalar measurement within a known range or a fractional value. It is also known as a gauge.This tag is new in html5 elements. Almost all the browser support this tag except the internet explorer.

Example:

<p>Poling result:</p>
<dl>
<dt>Party a </dt>
<dd><meter value=”9″ min=”0″ max=”10″>9 out of 10</meter></dd>
<dt> Party b </dt>
<dd><meter value=”7″ min=”0″ max=”10″>7 out of 10</meter></dd>
</dl>

Output:

Poling result:
Party a
9 out of 10
Party b
7 out of 10

PHP Data Types

There is generally various types of data types are present in php like-
Strings, Array, Boolean, Integer ,Object and Null.
  • A String is a type of data. A string can contain letters, numbers or characters.  A string can be short or long.
  • Here is the example of string:
<?php$stringA = “Hello World”;?>
  • An Array is a collection of data values, organized as an ordered collection of key-value pairs.
  •      Here is the Example of  Array:

<?php $bikes=array(“Yamaha”.”Hero”,”TVS”,”Honda”); var_dump($bikes);?>

  •  The boolean data type represents only two values that can be either 1 or 0.Boolean values are used mainly to compare conditions for use in conditional statements. For example, PHP evaluates an expression, such as $a > $b, so the  output is either TRUE or FALSE.

  •  The number which do not contain any decimal point is called Integer.
  •  Integer can be possitive or negative but integer do not contain any comma and blank. It can be express any of the three formats i.e. decimal, haxadecimal, octal.
<?php$a = 65;
var_dump($a);
?>
  • An Object is a php data type size that store the data and information,
    object should be explicitly declare.
    
  <?php
class a {}
class b extends a
{
function sayHelloWorld()
{
print "HelloWorld";
}
}
$x = new a();
$x->sayHelloworld();
?>
  • NULL value shows that variable has no value.
<?php
$a=”Hello!”;
$a=null;
var_dump($a);
?>

Wednesday, 8 July 2015

HTML5 Form Attributes Tutorial

HTML elements also have attributes which provide the additional information about an element. Attributes are like blue print schematics informing the browser how to render an HTML element. Attribute always come in name and value pair.
The name is the property you want to set and the value is what you want the value of the property to be.
The value of the html5 attribute should be put in double quotation marks, and is differentiated from the name by the equals sign. You can see that a color for the text has been define as well as the typeface in this <font> element:

<font face=”Times New Roman” color=”013975″>

The title attribute:

The title attribute titles an HTML element and adds a tiny text pop-up to any HTML element,It defines a title to keep company with the component,several browser can show this once the pointer hovers the component.

Example:

<h3 title=”Hello World”>Titled Heading Tag Example</h3>

The id attribute:

The id attribute can be used to uniquely identify any element within a page.If you have two elements of the same name within a Web page you can use the id attribute to distinguish between elements that have the same name.

Example:

<p id=”html tags”>This paragraph explains all about HTML tags</p>
<p id=”php”>This paragraph explains what is php</p>

The class attribute:

The class attribute is employed to associate an element with a style sheet, and defines the class of element.It specifies the element class name.

Example:

class=”html 4.1 html 5″
The style attribute:
It defines Helps to include inline cascading style sheet.

Example:

<p style=”font-family:arial black; color:#2d2d2d;”>description…</p>

The  Formaction attribute:

The formaction html attribute elements defines the URL of a file that will process the input control when the form is submitted. This attribute overrides the action attribute of the <form> element.

Example:

<form action=”example_form.php”>
Username: <input type=”text” name=”uname”><br>
Password: <input type=”text” name=”password”><br>
<input type=”submit” value=”Submit”>
</form>

Output:


Username: Password:

Submit

PHP Echo / Print

 Difference between PHP echo() and PHP print()?
Echo and Print are almost same both are used to display the output but there is minor difference between these two is that :
  • Echo is more faster than print.
  • PHP print() has a return value , whereas PHP echo() has a void return type.
  • PHP echo() and php print() both are different. print() return value on the other hand echo() not return any value.
  • Echo is a constructor and Print is a function.
  • In PHP, echo is not a function but a language construct, whereas print is not a function but a language construct. However, it behaves like a function in that it returns a value.
  • One of the most important difference in between these : Echo can take multiple values whereas print cannot, it take only one parameter.
  • We take a example it became easy for you to understand this.
  • Firstly taking a example of  php echo in php:
<html><head>
<title> echo  program</title>
</head>
<body>
<?php
echo’cascading’,’style’,’sheet';
//one or more strings

?>
</body>
</html>
  • Output will be:
cascadingstylesheet
  •  Now we take a Example of print:
<html><head>
<title> print program</title>
</head>
<body>
<?phpprint ‘cascading’,’style’,’sheet';?>
</body>
</html>
  • Output will be:
Parse error: syntax error, unexpected ‘,’ on line number 7, because print only display one string.
  •  Now we take again print Example having one string:
<html><head>
<title>print program</title>
</head>
<body>
<?php
<>print ‘name';//one or more strings
?>
</body>
</html>
  • Output will be:

name

Tuesday, 7 July 2015

HTML5 Semantic Tutorial

Semantics is one of the most distinctive features of the Web Platform versus other application platforms. A semantic element clearly describes its meaning to both the browser and the developer.HTML5 offers new semantic elements to clearly define different parts of a web page:
  • <header>
  • <nav>
  • <aside>
  • <section>
  • <footer>

HTML5 <header> element:

The header element is employed to define a header for a document or section.The content within header tag is implies on the top of the page.The header tag is new in HTML5 semantic tutorial. Almost all the browser support this tag.

Example:

<header><h3>Main heading of the article</h3><p>Here we discussing the whole article………</p></header>

Output:

Main heading of the article

Here we discussing the whole article…….

HTML5 <nav> element:

The <nav> element is used to defines a set of navigation links.

Example:

<nav>
<a href=”/html/”>HTML</a>
<a href=”/php/”>PHP</a>
<a href=”/seo/”>SEO</a>
<a href=”/contact-us/”>Contact Us</a>
</nav>

Output:

HTML
PHP
SEO
Contact Us

HTML5 <aside> element:

The <aside> element defines some content aside from the content it is placed in,aside content is related to surrounding content.

Example:

<p>Me and my family going to Zurich this summer.</p><aside>
<h4>Zurich</h4>
<p>Zurich is the beautiful city of Switzerland.</p>
</aside>

Output:

Me and my family going to Zurich this summer.

HTML5 <section> element:

The section element is employed to define sections in a document, such as chapters, headers or any other sections of the document.This tag display the generic section of the document or applications. The section tag is new in HTML5. This tag support all the browsers.

Example:

<html>
<body><section>
<h3>What is World health report?</h3>
<p>World health report, first published in 1995, is WHO’s leading publication. The report combines an expert assessment of global health, including statistics relating to all countries, with a focus on a specific subject.</p>
</section><section>
<h3>Purpose of the report?</h3>
<p>The main purpose of the report is to provide countries, donor agencies, international organizations and others with the information they need to help them make policy and funding decisions. The report is also offered to a wider audience, from universities, teaching hospitals and schools, to journalists and the public at large in fact, with a professional or personal interest in international health issues.</p>
</section></body>
</html>

Output:

What is World health report?

World health report, first published in 1995, is WHO’s leading publication. The report combines an expert assessment of global health, including statistics relating to all countries, with a focus on a specific subject.

Purpose of the report?

The main purpose of the report is to provide countries, donor agencies, international organizations and others with the information they need to help them make policy and funding decisions. The report is also offered to a wider audience, from universities, teaching hospitals and schools, to journalists and the public at large in fact, with a professional or personal interest in international health issues.

HTML5 footer element:

The footer element is employed to define a footer for a document or section.The Contact information within a footer tag should be marked up using the address tag.This tag is new in HTML5 tutorial. Almost all the browser support this tag.

Example:

<footer>
<p>Posted by: Dhruv Talwar</p>
<p>Contact information: <a href=”info@libratechnology.com”>
info@libratechnology.com</a>.</p>
</footer>

Output:

Posted by: Dhruv Talwar

HTML5 Semantics elements:


HTML 5 tags Description
<article> It determines article.
<aside> It determines the content aside from the page content.
<canvas> It determines Used to draw graphics, on the fly, via scripting.
<figcaption> It indicates the Defines a caption for a <figure> element.
<figure> It determines the self contain content.
<footer> It indicates the footer of the content.
<header> It determines the header of the content.
<main> It indicates the main content.
<nav> It determines the navigation list.
<section> It determines the section of the documents.

PHP Loop Types

The loop in PHP is a sequence of instruction that is continually repeated until a certain condition is reached. PHP support 4 types of  lops
  • For loop:- A for php loop statements allows a number of lines represented until the condition is satisfied. In this no need to initialize variable before the loop.
  • Syntax of For loop:-
For (initialize counter variable,condition){// statement 1//
// statement n
}
  • While loop:- A while loop statement allows a number of lines represented until the condition is satisfied. In this to initialize the variable before the loop increment/decrement the variable within the loop.
  • Syntax of While loop:-
.While (condition){//statement 1//
//statement n
}
  • Do-While:- A Do-while loop statement allows a number of lines represented until the condition is satisfied.Once it execute  if the condition is true/false, first execute the statement then it checks for condition.
  • Syntax of Do-While loop:-
do{//statement 1//
//statement n
}
While (condition);

  • For each loop:- In this php loop tutorial 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.
  • Syntax of For each loop:-


foreach (array as value)
{
//statement 1;
}

Friday, 3 July 2015

HTML5 Web Storage Tutorial

HTML5 Web Storage Tutorial is a better local storage as compare to cookies. The web storage is supported by all the browser.
Generally there are two storage used in HTML5, these are-
  • Session Storage
  • Local Storage

Session Storage:

The Session Storage is intended  for situations wherever the user is carrying out a single transaction, however may be carrying out multiple transactions in numerous windows at the similar time. The session storage is equal to the local storage, leaving that it stores the data for only one session. The data ought to be deleted when the user closes the browser window.

Example:

<html>
<head>
<script>
if( sessionStorage.catch ){
sessionStorage.catch = Number(sessionStorage.catch) +1;
}
else
{
sessionStorage.catch = 1;
}
document.write(“Total catch :” + sessionStorage.catch );
</script>
</head>
<body>
<p>Refresh if you want to increase number of catches in the page.</p>
<p>Close the browser and try again.</p>
</body>
</html>

Local Storage:

The Local HTML5 Tutorial Web Storage is intented for storage that spans multiple windows, and lasts beyond the current session.The local storage stores the information with no expiration date. The information will not be deleted once the browser is closed and can be out there on the next day.

Example:


<html>
<head>
<script>
if( localStorage.catch ){
localStorage.catch = Number(localStorage.catch) +1;
}
else
{
localStorage.catch = 1;
}
document.write(“Total catch :” + localStorage.catch );
</script>
</head>
<body>
<p>Refresh if you want to increase number of catches in the page.</p>
<p>Close the browser and try again.</p>
</body>
</html>