Explain About $_server['PHP_SELF']

Posted October 1st, 2010 in PHP Tutorial by Paran
  • $_SERVER is an array defined in PHP and it stores information about your server and execution environment information.
  • $_SERVER['PHP_SELF'] variable:

This array element points out the filename of the currently executing script. For example, if you run www.cyberciti.biz/index.php, $_SERVER['PHP_SELF'] would be /index.php. This is relative to the document root. This is useful to referring HTML forms and other element.

What is PHP_SELF variable?

PHP_SELF is a variable that returns the current script being executed. This variable returns the name and path of the current file (from the root folder). You can use this variable in the action field of the FORM. There are also certain exploits that you need to be aware of. We shall discuss all these points in this article.

We will now see some examples.echo $_SERVER['PHP_SELF'];

a) Suppose your php file is located at the address:

 http://www.yourserver.com/form-action.php

In this case, PHP_SELF will contain:

 "/form-action.php"

b) Suppose your php file is located at the address:

 http://www.yourserver.com/dir1/form-action.php

For this URL, PHP_SELF will be :

 "/dir1/form-action.php"
VN:F [1.9.10_1130]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.10_1130]
Rating: 0 (from 0 votes)

How to Google Search Box Add on your site

Posted August 27th, 2010 in PHP Tutorial by Paran

Several time we need to add google search box in our site or client site. But how can we add this. Just I will provide you some HTML code, copy this code and paste on your desire place. Ok lets go to copy this code. Just follow the bellow code

<form method="get" action="http://www.google.com/search">

<input type="text"   name="q" size="31" maxlength="255" value="" />

<input type="submit" value="SearchSite" />

</form>
VN:F [1.9.10_1130]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.10_1130]
Rating: 0 (from 0 votes)

Function

Posted January 5th, 2010 in PHP Tutorial by Paran

Function is the combination of some code, those are not execute instantly. But when our necessary to call this function this another place, then we call this and work it.

Function are two types :

1. Built-in-function

2. User-defined-function

Built-in function are php own created function. That cannot be change. Several time we need to use this function. e.g phpinfo() is the built in function . If we use this function. This are automatically outputs a large amount of information about the current state of PHP. This includes information about PHP compilation options and extensions, the PHP version, server information and environment (if compiled as a module), the PHP environment, OS version information, paths, master and local values of configuration options, HTTP headers, and the PHP License.

Built in function are not enough for us. Several time we fell different problem. For remove this problem we need to create some function, these are called user-defined function. Now we need to know how to create a function.

Statement of a function:

function function_name()

{

echo ” How to develop web based world”;

}

VN:F [1.9.10_1130]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.10_1130]
Rating: 0 (from 0 votes)

Why Learn PHP?

Posted January 5th, 2010 in PHP Tutorial by Paran

May you are confusion fell, why I learn on php? Answer is simple, For several reason you can choose the php.

These are as follows:

  • It’s very easy programming language from other programming language.
  • For web development it’s  very popular language in the world.
  • By use it,  in a short time database can be  created for web application.
  • More advantage also get from the php.
VN:F [1.9.10_1130]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.10_1130]
Rating: 0 (from 0 votes)