1-Chapter ....
1-Chapter ....
• Home page -is a default page that is loaded into a browser when it is opened.
• Web site -is a collection of related web pages. Has a globally unique name.
• HTTP- used to exchange request/response messages between web browse and web server.
• Web Browser- is a software which is used to browse and display pages available over
internet.
Cont.…
Web server- is a software which provides these documents when requested by web browsers via HTTP.
URL- The exact address of a resource on the web. It have its own formats. (Protocol, hostname(Domain),
path ).
compiling.
It can be carryout on client side or server side .
The content of the web page will not be the same every time you look at it.
It will change dynamically depending on certain factors such as the actions of the person
Static Websites
Written in HTML only – web pages
Pages are separate documents
No database that draws to it
In a nutshell:
• Simple web pages with no interactivity
Cont...
Dynamic Websites
Requires more complex coding
Web pages can do a lot more – interactive!
Examples – login page, search page, querying a backend database
Has three major technologies:
• Markup language like HTML
• Scripting (both client and server side) language
• Style sheet (for presentation) like CSS
Static VS Dynamic Web Sites
Static Dynamic
Scripts are stored on the client (engine is in Scripts are stored on the server (engine is on
browser) server)
Scripts can be modified by the end user Scripts cannot be modified by the end user
Browser-dependent Browser-independent
Processing is done by the browser - fast Processing is done by the server - slower
8
Main Arguments for the Use of PHP
Main Reasons to Use PHP
Powerful and flexible
Easy to learn
Extremely portable
Cheap
Easy to set up
10
What is a PHP file?
11
Cont.…
• An embedded scripting language, meaning that it can exist within HTML code.
• Cross-platform, meaning it can be run on Linux, Windows, Macintosh, etc.,
making PHP very portable.
• Compatible with almost all servers used today (Apache, IIS, etc.)
• Supports many databases (MySQL, Informix, Oracle, Sybase, Solid,
PostgreSQL, Generic ODBC, etc.).
• Easy to learn and runs efficiently on the server side
12
What Can PHP Do?
13
PHP Does Not…
14
Why Use PHP?
• PHP has been described as being “better, faster, and easier to learn than the
alternatives”
• PHP runs on various platforms (Windows, Linux, Unix, Mac OS , etc.)
• PHP is compatible with almost all servers used today (Apache, IIS, etc.)
• PHP supports a wide range of databases (MySQL, Informix, Oracle, Sybase, Solid,
PostgreSQL, Generic ODBC, Microsoft SQL Server etc)
15
Cont..
Go to XAMPP server directory. I'm using Windows, so my root server directory is C:\
xampp
Open htdocs\.
Create folder-IT2015(folder name)
Install text editor (notepad, notepad++,sublime text…) , open and write code
The PHP parsing engine needs a way to differentiate PHP code from other elements
in the page. The mechanism for doing so is known as ‘escaping to PHP.’ There are four
ways to do this:
1. Canonical PHP tags
The most universally effective PHP tag style is:
If you use this style, you can be positive that your tags will always be correctly interpreted.
2. Short-open (SGML-style) tags: Short tags are, as one might expect, the shortest option.
We must do one of two things to enable PHP to recognize the tags:
PHP Basic Syntax
Choose the --enable-short-tags configuration option when building PHP.
Set the short_open_tag setting in php.ini file to on. This option must be disabled to parse
XML with PHP because the same syntax is used for XML tags.
3. ASP-style tags: ASP-style tags mimic the tags used by Active Server Pages to delineate
code blocks. To use ASP-style tags, we should set the configuration option in your php.ini
file.
1. echo
2. print.
22
PHP Output Statement
• echo has no return value whereas print has a return value.
• The returned value represents whether the print statement is succeeded or not.
• If the print statement succeeds, the statement returns 1 otherwise 0.
• echo can take multiple parameters but print can only take one argument.
echo is marginally faster than print.
The echo or print statement can be used with or without parentheses:
echo or echo().
23
Cont..
• The general format of the echo statement is as follows:
echo outputitem1,outputitem2,outputitem3, . . .;
echo (output statement);
The parameterized version of echo does not accept multiple arguments.
• The general format of the print statement is as follows:
print outputstatement;
print(outputstatement);
echo 123; //output: 123
echo/print
echo “Hello World!”; //output: Hello world!
echo (“Hello World!”); //output: Hello world!
echo “Hello”,”World!”; //output: Hello World!
echo Hello World!; //output: error, string should be enclosed in quotes
print (“Hello world!”); //output: Hello world!
• print (“Hello”, “world!”); //output: _______???