Thursday, 29 May 2014

Basics of Web Development



Basics of HTML

·         HTML stands for hypertext Markup language
·         In markup language we use <tags> </tags>
·         Tags do come with paired form like (<html>…</html>)
·         The well known tags are (<html>, <body>, <p>, <h1>, <h2>, <a>, <img>, <div>, <table>, <ul>, <li>,<form>,<input> )
·         The basic structure of html is given below:

<html>
<head>
<title> …content… </title>
 </head>
<body>
<h1> …content… </h1>
<p> …content… </p>
</body>
</html>

·         The editor which are used for html is Notepad, Notpad++ and dreamweaver

Basics of CSS

·         CSS stands for Cascading Style Sheets
·         CSS is basically for all the styling of webpage
·         CSS file can be added to internally or externally
·         If a style is included internally than there are two ways to do it
1.       <h1 style=”padding:20px;color:blue;”>..content..</h1>
2.       Or  <style>
 h1{
color:blue;
padding:20px;
}
</style>
·         You will create a file of extension .css. You will link this css file to where you want to call the styles. The main syntax of external CSS file is
Selector {
Property: value;
}
the linking syntax is given below:
<link rel=”stylesheet” types=”text/css” href=’’yourfilename.css” />

Basic Website
 

Extra Features of PHP5



Extra Features of PHP5

PHP was introduced on 13 July 2004. PHP5 is the latest ver. Of PHP. I have many new features like OOP, PDO (php data object) extension. We are here covering the new features of PHP5
·         It is more object oriented than PHP4
·         An abstract class can be declared in PHP5
·         It has a unique function autoload()
·         You can define a method or class as final
·         It has some magic functions like _get, _set, _call and _toString
·         It has clean error handling and exceptions as well
·         Private, Public and Protected has been introduced as well
·         Objects uses passed by reference
·         It has some new keywords and functions
·         It has a new extension of MySQL called MySQLi
·         It has a newly built-In extension called SOAP for interoperability of Web services
·         It has SimpleXML extension for making XML as PHP objects. It support DOM extension.
·         It has extra OOP concepts like Inheritance, Encapsulation and access specifiers
·         It consumes less RAM
·         It has new concept of errors like “E_STRICT
·         It has new interfaces as well
·         It introduces Constructor and Destructors
·         It is fully compatible with W3 standard
PHP 5.4.28 has been released on May 1st 2014. 9 bugs has been removed in this release. This is the latest update of PHP5.

$_POST, $_GET and Sessions Concept in PHP



What is Basic difference between $_POST & $_GET Method???

In POST method, the data is hidden and secured. No one can see it.
In GET method, the data is appended with the URL and you can see the data with a proper syntax in the URL
Description
Both methods are used in the HTML forms. Mostly $_POST method is used in HTML forms. Because it’s secure and there is no limitation of the length of the data as well.  In $_GET method there is limit of 255 characters.
As well as performance is concerned, $_GET is faster than $_POST. Time is spent in the encapsulation of the data with HTTP in $_POST.
In $_GET method you can send only text whereas in $_POST method there is no restriction on the data types.
Cashing and Bookmarking can be done with $_GET method but nothing with $_POST method.
$_GET is the default method of the form but for $_POST you have to specify before submission.
$_GET is limited to ASCII characters but $_POST method has encrypt attribute (multipart/form data).

Syntax of $_GET & $_POST

Let suppose you have a input fields in the form. The name of the input field is very important like this:
<input id="firstName" type="text" name="first_name"/>
You can use $_POST method like this:
$first_name = $_POST[' first_name'];
This thing will return the same name which you will type in the text field.
For $_GET Method:
$first_name = $_GET[' first_name'];
NOTE: For $_POST method, you have to mention the “POST” method in the attributes of the form.

What is session in PHP???


This is the most general question in the PHP world and most of people does not know the exact answer of this question.

Definition:

A PHP session is used to store the information of the user for later use like (user_id, username, order_id).  The session is temporarily maintained on server side.
Session creates a unique id for each new visitor on the website. This thing helps the users to prevent the mixing of the data of users.

Syntax:

First of all you have to start the session at the first line of your file like this.
<?php session_start(); ?>
How to store a session variable??
It’s very simple. Like you want to store a UID of a user.
$_SESSION[‘user_id’]= 5;
Now you can take this id to any of the page before ending the session.
For cleaning and destroying session:
 unset($_SESSION[‘user_id’]); //this will clean your session of user_id
 session_destroy();  // This will completely destroy your session.Dnt call that function until you really want to destroy it.

Yellow color is showing the coding part of related topic.