BCA Semester IV Web Programming Using PHP Modules 1, 2, 3, 4 (3)
BCA Semester IV Web Programming Using PHP Modules 1, 2, 3, 4 (3)
# Internet: is a global system of interconnected comp networks that use the standard
Internet protocol suite(TCP/IP) to serve billions of users worldwide
#web: Web consists of billions of clients and server connected through wires and
wireless networks.
- The web clients make requests to web server. The web server receives the request,
finds the resources and return the response to the client.
- When a server answers a request, it usually sends some type of content to the client.
- The client uses web browser to send request to the server.
- The server send instructions written in HTML(HyperText Markup Language)
*WWW operation:
- User enters the URL (say, http://www.tutorialspoint.com) of the web page in the
address bar of web browser.
-Then browser requests the Domain Name Server for the IP address corresponding to
www.tutorialspoint.com.
-After receiving IP address, browser sends the request for web page to the web server using
HTTP protocol which specifies the way the browser and web server communicates.
-Then web server receives request using HTTP protocol and checks its search for the
requested web page. If found it returns it back to the web browser and close the HTTP
connection.
-Now the web browser receives the web page, It interprets it and display the contents of
web page in web browser’s window.
2.dynamic web page: -the Content of pages is different for different visitors.
- It takes more time to load than the static web page.
-Dynamic web pages are used where the information is changed frequently,
eg: stock prices, weather information, etc.
*between Static and Dynamic Web Page
static dynamic
-Pages will remain same until -Content of pages are different
someone changes it manually for different visitors
-Static Web Pages are simple -Dynamic web pages are
Information are change rarely complicated
-less time for loading than dynamic -Information are change
web page frequently
-database is not used. more time for loading
-database is used.
*scripting language: Scripting languages are like programming languages that allow
us to write programs in form of script.
- These scripts are interpreted not compiled and executed line by line.
-Scripting language is used to create dynamic web pages.
-types of scripting language
1.server side scripting . 2.client side scripting
*Web server: is a computer where the web content is stored.web server is used to host the web
sites but there are other web server also available like gaming,storage,email,etc
# WWW Architecture: www are commonly known as World Wide Web.it is created in
1989.
*Working of WWW: -The World Wide Web is based on several different technologies: Web
browsers, Hypertext Markup Language (HTML) and Hypertext Transfer Protocol (HTTP).
-A Web browser is used to access webpages.
-Web browsers can be defined as programs which display text, data, pictures, animation and
video on the Internet.
- Hyperlinked resources on the World Wide Web can be accessed using software interface
provided by Web browsers.
-Web browsers can be used for several tasks including conducting searches, mailing,
transferring files, and much more.
-Some of the commonly used browsers are Internet Explorer, Opera Mini, Google Chrome.
*Components of Web: There are 3 components of web:
1. Uniform Resource Locator (URL): is used to specify address on www.
2.HyperText Transfer Protocol (HTTP): specifies communication of browser and server.
3.Hyper Text Markup Language (HTML): defines structure, organisation and content of
webpage
“bakki mukaliulndee www ,web page ennu oka parayunnathu www architecture thanna annu”
#Fundamentals of HTML
-HTML stands for Hypertext markup language
-it is the most widely used lang to write webpage
-we can write html with any available text editors .
-HTML is the language that allows text and graphics to be displayed as Web pages.
-HTML uses a series of Special Codes called Tags.
-Tags tell a browser application such as Internet Explorer how to display the web page.
Tags are surrounded with angle brackets”<> “along with some words
Eg:<title>
-open tag:<title>
-close tag:</title>
*structure of HTML document: A html file has two parts
1.Head part: <head>..........</head>
-head section can be viewed in the head tag
2.body part: <body>...........</body>
-body section encloses the info to be displayed in a web page
Eg; <html>
Head part
<head>
<title> web page</title>
</head>
Body part
<body>
<h1>hello</h1>
</body>
</html>
11.Larger Text: If you want to put your font size larger than the rest of the text then put
the content within <big>........</big>. It increase one font size larger than the previous
one.
12. Smaller Text: If you want to put your font size smaller than the rest of the text then put
the content within<small>........./small>tag. It reduces one font size than the previous
one.
*HTML heading: there are six diff heading which is <h1> to<h6>.h1 is larger heading
tag and h6 is the smallest heading tag bakki nammal thanna ezhuthuka pinna
eg:<h1>hello</h1>.....
#marquee: The <marquee> tag is a container tag of HTML is implemented for creating scrollable
text or images within a web page from either left to right or vice versa, or top to bottom or vice
versa
1.width: This specifies the width of the marquee. This can be a value like 10 or 20% etc.
2.height: This specifies the height of the marquee. This can be a value like 10 or 20% etc.
3.direction: This specifies the direction in which marquee should scroll. This can be a
value like up, down, left or right.
4.behavior: This specifies the type of scrolling of the marquee. This can have a value
like scroll, slide and alternate.
5.scrolldelay: This specifies how long to delay between each jump. This will have a value
like 10 etc.
6.scrollamount: This specifies the speed of marquee text. This can have a value like 10 etc.
7.loop: This specifies how many times to loop. The default value is INFINITE, which means
that the marquee loops endlessly.
8.bgcolor: This specifies background color in terms of color name or color hex value.
9.hspace: This specifies horizontal space around the marquee. This can be a value like 10
or 20% etc.
10.vspace: This specifies vertical space around the marquee. This can be a value like 10 or
20% etc.
some example of are; scroll up, scroll down, scroll left to right,scroll speed
#Inserting images: Html provide a tag <IMG> to insert in HTML pages.
-The <IMG> tag is an empty tag
-it means that it contain only list of attributes
-it has no closing tag
-following are imp attribute of<IMG>tag
• src - Specifies the path (url) to the image
• alt - Specifies an alternate text for the image
#HTML Hyperlink(linking)/HTML links: The anchor tag can be used to create a link to
another document.
-A hyperlink (or link) is a word, group of words, or image that you can click on to jump
to a new document or a new section within the current document.
-When you move the cursor over a link in a Web page, the arrow will turn into a little
hand.
-This type of text that provides linking is called "Hyper Text".
Eg; <a href=”url”>link text </a>
A=create an anchor
Herf=target url
-two types of linking
1. External linking: is used to interconnect two html webpages.
- When you want to navigate to some other page or any other URL by clicking
on a link on webpage, external links are created.
-An external link can be created by using anchor tag in html web page
2. Internal linking: is used in html page to navigate properly in the webpage.
- If you want to go to any specific location in the same page by clicking on a link,
you can create an internal link in the webpage.
- <a> tag is used for link creation in html page
#HTML Lists: are used to specify lists of information.
- All lists may contain one or more list elements.
- There are three different types of HTML lists:
1. Ordered List or Numbered List (ol): all the list items are marked with numbers by default.
- It is known as numbered list also. The ordered list starts with <ol> tag and the list items
start with <li> tag.
Eg; 1.albert 2.appu...
2. Unordered List or Bulleted List (ul): all the list items are marked with bullets.
-It is also known as bulleted list also.
-The list starts with <ul> tag and list items start with the <li> tag.
Eg;
• Aries
• Bingo
3.Description List or Definition List (dl): This arranges your items in the same way as they are
arranged in a dictionary.
-Definition List makes use of following three tags.
• <dl> − Defines the start of the list
• <dt> − A term
• <dd> − Term definition
• </dl> − Defines the end of the list
#HTML tables: is used to display data in tabular form (row * column). There can be
Many columns in a row
-We can create a table to display data in tabular form, using <table> element, with the
help of <tr> , <td>, and <th> elements.
-In Each table, table row is defined by <tr> tag, table header is defined by <th>, and table
data is defined by <td> tags
-most imp tags related to table creation are;
1.<table>.....</table>: It defines a table. Most important attributes of table tag are;
(i) Allign;- Takes LEFT, RIGHT OR CENTER as its values and aligns the table with
respect to surrounding information.
(ii) Background: - The value of this attribute has to be an image URL. This image is
displayed as the background of the table.
(iii) BgColor: - Specifies the background color.
(iv) Border: - It makes a border around the table. The thickness of this border
depends on the number of pixels supplied as its value.
(v) BorderColor:- Table borders can be coloured using his attribute.
(vi) CellPadding:- Its value supplied as number of pixels, denotes the amount of
space between the edge of the table and its contents.
(vii) Height: specifies the table height
(viii) Width:
2. <CAPTION>........ <CAPTION>: It defines the table caption.
-which gives the reader a content for the information in the tables.
-Table headings are called captions
-Captions can be provided to the table using the <caption> tag .
- It has an attribute ALIGN
ALIGN= BOTTOM will place the caption immediately below the table
TOP will place the caption immediately above the table.
4. <TD>........ </TD>: It is used to insert data into the table. Its attributes are;
(i) Align:
(ii) Valign:-Aligns the contents to the top, middle or bottom of the cell
(ii) BGColor:
(iv) BorderColor:
(v) Rowspan:- To extend data cell across more than one row. Value has to be an integer
number.
(vi) COLSPAN: - To extend data cells across more than one columns Its value has to be
an integer
(vi) Height:- Specifies the height of the cell. (vii) Width:- Specifies the width of the cell.
(vii)width:
5<TH>.....</TH>: It defines a header cell in a table
#HTML frames: are used to divide your browser window into multiple sections
where each section can load a separate HTML document.
- A collection of frames in the browser window is known as a frameset.
-The window is divided into frames in a similar way the tables are organized: into
rows and columns
*Disadvantages of Frames
-There are few drawbacks with using frames, so it's never recommended to use frames in
Your webpages they are;
-Some smaller devices cannot cope with frames often because their screen is not big
enough to be divided up.
-Sometimes your page will be displayed differently on different computers due to
different screen resolution.
-The browser's back button might not work as the user hopes.
-There are still few browsers that do not support frame technology.
-Frames are generated by
1. frame document: the tag <body>is replaced by <frameset> tag , that describes the
sub htmldocument or frames that make up the page
2.frame tags: Name,height,width etc..
#HTML Forms: is used to collect user input. The user input is most often sent to a server for
Processing
Eg:
First name:
John
Last name:
Doe
-Form attributes:
1.Action: Backend script ready to process your passed data.
2.Method: Method to be used to upload data. The most frequently used are GET and
POST methods
3.Target: Specify the target window or frame where the result of the script will be
displayed. It takes values like _blank, _self, _parent etc
4.Enctype: You can use the enctype attribute to specify how the browser encodes the data
before it sends it to the server. Possible values are −
application/x-www-form-urlencoded − This is the standard method most forms use in
simple scenarios.
mutlipart/form-data − This is used when you want to upload binary data in the form of
files like image, word file etc
*HTML Form Controls: There are different types of form controls that you can use to
collect data
• Text Input Controls: thaza explain unde
• Checkboxes Controls: used when more than one option is required to be selected.
They are also created using HTML <input> tag but type attribute is set to checkbox
• Radio Box Controls: are used when out of many options, just one option is required
to be selected. They are also created using HTML <input> tag but type attribute is set
to radio
• Select Box Controls: which provides option to list down various options in the form
of drop down list, from where a user can select one or more options.
• File Select boxes: user to upload a file to your web site, you will need to use a file
upload box, also known as a file select box. This is also created using the <input>
element but type attribute is set to file.
• Hidden Controls:
• Clickable Buttons:
• Submit and Reset Button:
$ Text Input Controls:There are three types of text input used on forms −
1.Single-line text input controls − This control is used for items that require only
one line of user input, such as search boxes or names. They are created using
HTML <input> tag.
2.Password input controls − This is also a single-line text input but it masks the
character as soon as a user enters it. They are also created using HTMl <input>
tag.
3.Multi-line text input controls − This is used when the user is required to give
details that may be longer than a single sentence. Multi-line input controls are
created using HTML <textarea> tag.
module 2 – CSS
*CSS Font: -CSS Font property is used to control the look of texts.
-By the use of CSS font property you can change the text size, color, style
and more.
-These are some important font attributes:
1.CSS Font color: This property is used to change the color of the text. (standalone attribute)
2. CSS Font family: This property is used to change the face of the font.
-can be divided in two types:
i)Generic family: It includes Serif, Sans-serif, and Monospace.
ii)Font family: It specifies the font family name like Arial, New Times
Roman etc.
3. CSS Font size: This property is used to increase or decrease the size of the font.
4. CSS Font style: This property is used to make the font bold, italic or oblique.
5. CSS Font variant: This property creates a small-caps effect.
6. CSS Font weight: This property is used to increase or decrease the boldness and lightness
of the font.
“bakki ullathu onnu explain cheyanaaa”
*Text formatting: -used to format text and style text.
-types of text fromating;
1.Text-color: -is used to set the color of the text
-Text-color can be set by using the name “red” or hex value or by its RGB value
2.Text Alignment: Text alignment property is used to set the horizontal alignment of
the text.
-The text can be set to left, right, centered and justified alignment
3. Text Decoration:- is used to add or remove decorations from the text.
-it can be underline, overline, line-through or none
4. Text Transformation: This property can be used to change cases of the text.
- It can be defined by using capitalize, uppercase, lowercase properties.
5. Word Spacing: This property can be used to give space between words
6. Letter Spacing: This property can be used to give space between characters
7. Line Height: This property can be used to give space between the lines.
-It can be defined by using line-height property
8. Line width:
9. Font Family: This property is used to provide various types of font-family names for
the selected text.
10. Text-shadow: This property can be used to give shadow for the text
*Text- pseudo classes: -are used to add special effects text.
-most commonly used pseudo-classes are;
1.link: Use this class to add special style to an unvisited link.
2.visited: Use this class to add special style to a visited link.
3.active: It is used to add style to an active element.
4.hover: It adds special effects to an element when the user moves the
mouse pointer over the element.
*CSS selectors: are used to select the content you want to style
-We can divide CSS selectors into five categories:
1. Simple selectors (select elements based on name, id, class)
2.Combinator selectors (select elements based on a specific relationship
between them)
3.Pseudo-class selectors (select elements based on a certain state)
4.Pseudo-elements selectors (select and style a part of an element)
5.Attribute selectors (select elements based on an attribute or attribute value)
#javascript:-is a powerful, object-based scripting language
- developed by Netscape.
- it is the world's most popular programming language.
-it is the programming language of the Web.
-it is easy to learn.
- It can be embedded directly into HTML pages.
-There are some rules while declaring a JavaScript variable (also known as identifiers).
1.Name must start with a letter (a to z or A to Z), underscore( _ ), or dollar( $ )
sign.
2.After first letter we can use digits (0 to 9), for example value1.
3.JavaScript variables are case sensitive, for example x and X are different
variables.
3. if…else nesting
We should use the if….else nesting if we want to select one of many sets of lines to execute.
Syntax
if (condition1) {
code to be executed if condition1 is true
}
else if (condition2) {
code to be executed if condition2 is true
}
else {
code to be executed if condition1 and condition2 are not true
}
4. switch Statement
We should use the switch statement if we want to select one of many blocks of code to be
executed.
Syntax
switch(n)
{
case 1:
execute code block 1
break;
case 2:
execute code block 2
break;
default:
code to be executed if n is different from case 1 and 2
}
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.
*JavaScript loops : if you want to run the same code over and over again, each time with a
different value.
-There are four types of loops in JavaScript;
1)For loop: iterates the elements for the fixed number of times. It should be used if number of
iteration is known. The syntax of for loop is given below.
for (initialization; condition; increment)
{
code to be executed
}
2)while loop: iterates the elements for the infinite number of times. It should be used if number of
iteration is not known. The syntax of while loop is given below.
while (condition)
{
code to be executed
}
3)do while loop: iterates the elements for the infinite number of times like while loop. But, code
is executed at least once whether condition is true or false. The syntax of do while loop is given
below.
Do
code to be executed
while (condition);
-when tha page loads,it is called an event.when the user clicks a button that click too is
an event .other example include events like pressing any key,closing a window,resizing
a window etc
-HTML events are”things” that happen to HTML element.
*Javascript popup boxes: are used to display the message or notification to the user.
-types of popup boxes are;
1.Alert Box: is often used if you want to make sure information comes through to the
User. When an alert box pops up, the user will have to click "OK" to proceed.
Syntax
window.alert("sometext");
2. Confirm Box: is often used if you want the user to verify or accept something.
When a confirm box pops up, the user will have to click either "OK" or "Cancel" to
Proceed.If the user clicks "OK", the box returns true. If the user clicks "Cancel", the box
returns false.
Syntax
window.confirm("sometext");
3. Prompt Box: is often used if you want the user to input a value before entering a page.
When a prompt box pops up, the user will have to click either "OK" or "Cancel" to proceed
after entering an input value.
Syntax
window.prompt("sometext","defaultText");
*prompt(): - method displays a dialog box that prompts the visitor for input.
-A prompt box is often used if you want the user to input a value before entering a page.
-The prompt() method returns the input value if the user clicks "OK". If the user clicks
"cancel" the method returns null.
eg;
*confirm() :-method displays a dialog box with a specified message, along with an OK and
a Cancel button.
-A confirm box is often used if you want the user to verify or accept something.
“Note: The confirm box takes the focus away from the current window, and forces the
browser to read the message.”
-The confirm() method returns true if the user clicked "OK", and false otherwise.
*built-in objects:
i)PHP Single Line Comments: There are two ways to use single line comments in PHP.
o // (C++ style single line comment)
o # (Unix Shell style single line comment)
ii) PHP Multi Line Comments: need to enclose all lines within /* */
/*
Anything placed
within comment
will not be displayed
on the browser;
*/
*PHP echo Statement: -The echo statement can be used with or without
parentheses: echo or echo().
-echo has no return value.
*PHP print Statement: -The print statement can be used with or without
parentheses: print or print().
-print has a return value of 1.
*PHP Data Types: Variables can store data of different types, and different data types
can do different things.
Module -5 – MySQL
*Uses of MySQL
• Huge websites like Facebook, Twitter, Uber, YouTube, etc.
• Content Management Systems like WordPress, Drupal, Joomla!, Contao, etc.
• A very large number of web developers around the world.
#mysql datatypes :- Data Type specifies a particular type of data, like integer, floating
points, Boolean, etc.
-MySQL uses many different data types broken into three categories −
1.Numeric Data Type :- These data types can include the exact numeric data types (For
example, integer, decimal, numeric, etc.),
-as well as the approximate numeric data types (For example, float, real, and double
precision).
-It also supports BIT datatype to store bit values.
-In MySQL, numeric data types are categories into two types, either signed or
unsigned except for bit data type
*TINYINT:- It is a very small integer that can be signed or unsigned.
*SMALLINT:- It is a small integer that can be signed or unsigned.
*MEDIUMINT:- It is a medium-sized integer that can be signed or unsigned.
*INT:- It is a normal-sized integer that can be signed or unsigned
*FLOAT:- It is a floating-point number that cannot be unsigned.
2.Date and Time Data Type:-This data type is used to represent temporal values such
as date, time, datetime, timestamp, and year.
-Each temporal type contains values, including zero.
-When we insert the invalid value, MySQL cannot represent it, and then zero value is
used.
*YEAR[(2|4)]:- Year value as 2 digits or 4 digits.
*DATE:- Values range from '1000-01-01' to '9999-12-31'.
*TIME:- Values range from '-838:59:59' to '838:59:59'.
3. String Data Types:-The string data type is used to hold plain text and binary data,
for example, files, images, etc
*TINYTEXT:- It can have a maximum size of 255 characters.
*TEXT:- Maximum size of 65,535 characters.
*MEDIUMTEXT:- It can have a maximum size of 16,777,215 characters.
*LONGTEXT:- t can have a maximum size of 4GB.