WebTechnologies Lecturenotes 5modules
WebTechnologies Lecturenotes 5modules
MODULE I
An outline of HTML
Web pages are typically created using HTML, or Hyper Text Markup
Language. It combines markup language, which describes the text
material within tags, with hypertext, which describes the interaction
between web pages, to structure online sites. This language can be used
to annotate text to facilitate appropriate manipulation and machine
comprehension. Tags are used in human-readable HTML to identify which
textual components need to be edited.
What is HTML?
HTML Sample:
“<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h2>Welcome To GFG</h2>
<p>Hello Geeks</p>
</body>
</html>”
Two of HTML's many features are its platform independence and ease of
usage.
The browser extends its effects till the end of the page if the beginning
tag is absent. The fundamental components of an HTML page—the
doctype declaration, HTML, head, title, and body elements—are covered
in great detail in this section. Structure of an HTML Page
The HTML page's fundamental structure is displayed below. It includes the
fundamental pieces that comprise every web page: HTML, the doctype
declaration, the head, title, and body elements.
“<!DOCTYPE html> “– This is the declaration of the document type (not
“<html> – The HTML root element is what's known as this. It contains all
<style> – With the use of CSS, this HTML tag enables us to add styling to
our webpages and make them aesthetically pleasing.
<title> – When you visit a website, the title—which shows the title of the
pages you are currently viewing—is what appears at the top of your
browser.
on its own.
Stated differently, the content that appears on the browser's front end is
Benefits of HTML
One of HTML's drawbacks is that it can only produce static web pages.
Example :
“<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, initial-scale=1.5">”
“ <title>HTML</title>
</head>
<body>
<p>MBU</p>
</body>
</html>”
HTML Headings
Headings for a webpage's content are made using the HTML heading tags.
Usually, the body tag contains these tags. The six heading tags available
in HTML are <h1> through <h6>, and they each display the heading in a
different font size.
“<h1></h1>
<h2></h2>
<h3></h3>
<h4>\/h4>
<h5></h5>
Formatting HTML Text: HTML text formatting tags improve the semantic
meaning and visual display of web content. Website readability and user
experience can be enhanced by styling content as bold, italicised,
emphasised, or essential by utilising tags like <b>, <i>, <em>, and
<strong>.
“1. Logical Tags: These tags indicate the text's logical or semantic
significance. They make a point without overtly altering the appearance.
By changing font styles, widths, and other visual characteristics, these tags
have a direct effect on how the text looks visually.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<p>
<strong>Strong:</strong>
</p>
<p>
<em>Emphasized:</em>
</p>
<p>
<b>Bold:</b>
</p>
<p>
<i>Italic:</i>
</p>
<p>
<mark>Marked:</mark>
</p>
</body>
</html>”
The WBR element is provided by HTML and can be used to add word breaks
in an HTML text between paragraphs or words. Nonetheless, you can use
the WBR tag if there needs to be a space between the words. While the BR
tag breaks the line regardless of the amount of space on the online page,
the WBR tag does not require the online browser to do so.
Preformatted text in HTML tells the browser that the content inside is
formatted and shouldn't be formatted again with the PRE tag. HTML's
default behaviour is to display text without formatting, regardless of spaces
or tabs. When this happens, you can use the PRE tag to maintain the
desired formatting. This tag is frequently used for content that has
predefined formatting, including poems and code snippets. The contained
text is shown by the browser in a monospaced font like Courier New.
You can use the BOLD, ITALIC, and LINK tags inside the PRE tag, per the
requirements for HTML and Extensible Hypertext Markup Language
(XHTML). What the DIV tag means
To divide a web page into distinct sections or divisions, utilise the HTML
division (DIV) tag. In essence, the DIV tag holds the other HTML tags within
it. You can apply the Cascading Style Sheet (CSS) to the HTML tags and
group them into sections using the DIV tag.
It is not possible to utilise the block-level DIV tag inside of the P tag. The
DIV tag is used to separate the web page into several sections, whereas
the P tag is solely used to create paragraphs. What the SPAN tag means
Using the style attribute, the SPAN tag can be used to alter the style of the
text included within the tag. The SPAN tag is used in conjunction with style
sheets to establish presentational attributes that specify the content's style,
giving it additional formatting capabilities over HTML tags.
CAPTION tag: Using the CAPTION tag, you can also specify the table
caption, which describes the contents of the table.
Ruby tag : Define the Ruby (text with captions) Using the Ruby tag on
your webpage, you can specify the caption for your text. Ruby annotations
that offer a reading or pronunciation help for a certain language, such
Chinese or Japanese, are specified using this tag. A ruby is a component of
an annotation pair, where a text passage (referred to as ruby text) is
connected to another text collection (referred to as ruby base).
Ruby annotations are frequently employed to provide a pronunciation aid
in a variety of publications, such as school texts and periodicals, in several
Asian nations, including China and Japan.
The ruby text and the ruby base are connected structurally by means of
these tags. The term "structural association" describes the several
connections that can be made between the ruby text and ruby base. The
text that appears in the Ruby tag before the RT tag is referred to as the
base text. On the other hand, the content that follows the RT tag is referred
to as the "notation."
Web pages are connected by HTML links, also known as hyperlinks, which
are made with the `} tag and the `href} property. They make it possible
for users to move between resources or pages. Links improve site
navigation and engagement and can be text, image, or other elements.
Links allow users to move between various pages or resources with a
single click.
“<!DOCTYPE html>
<html>
<head>
<title>HTML Links</title>
</head>
<body>
<a href="https://www.MBU.org">
MBU
</a>
</body>
</html>”
We show how to use target properties in links in this example. The context
in which each link opens varies: _blank opens in a new tab or window, _self
opens in the same frame, _parent opens in the parent frame, _top opens
in the entire window body, and framename opens in a designated frame.
“<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h3>
Target Attribute
</h3>
<p>
</p>
<a href="https://www.geeksforgeeks.org"
target="_blank">
MBU
“ </a>”
“ <p>
</p>
<a href="https://www.MBU.org"
target="_self">
MBU
</a>”
“ <p>
</p>
<a href="https://www.MBU.org"
target="_top">
MBU
</a>
<p>
parent frame.
</p>
<a href="https://www.MBU.org"
target="_parent">
MBU
</a>
</body>”
</html>”
Creating Tables
<!DOCTYPE html>
<html>
<body>
<table>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
<tr>
<td>Priya</td>
<td>Sharma</td>
<td>24</td>
</tr>
<tr>
<td>Arun</td>
<td>Singh</td>
<td>32</td>
</tr>
<tr>
<td>Sam</td>
<td>Watson</td>
<td>41</td>
</tr>
</table>
</body>
</html>”
“An HTML table is defined by the "table" tag. Every row in a table is
defined using the "tr" tag. A table header is defined by the "th" tag. By
default, table headers are bold and centred. A table data/cell is defined by
the "td" tag. “
Table Section
“Table cells are the basic building blocks that make up a table. It is
denoted by an end tag and a start tag. “
Syntax Content
Rows of Tables
Syntax
“</tr> Content... </tr>”
Table Headings
Usually, the Heading is provided by the Headers. The heading for the table
can also be added using the Table Headers. The & tags are contained in
this.
Syntax
“</th> Content... </th>”
To set a border, utilise the CSS border property. The table will be
displayed without a border if you choose not to give it one.
“Syntax:
Add the CSS border-collapse attribute to make borders collapse into one
border.
Syntax:
Table, th, td
{ border: 1px solid black; border-collapse: collapse;
By linking them, images can be embedded into web pages using the HTML
tag. It does not need a closing tag; instead, it generates a placeholder for
the picture, defined by characteristics like src, width, height, and alt.
Adding photos to a webpage: photos can be embedded into web pages using the tag,
which only needs attributes and no closing tag. Using the tag, images improve the
quality of both design and content.
“Syntax:
“<img src="url" alt="some_text" width="" height="">”
ATTRIBUTES:
crossorigin: Usually used with canvas, this feature enables the import of
photos from external websites that have cross-origin access.
height : Indicates the image's height.
width: indicates the image's width.
CANVAS:
JavaScript is used to draw images on a web page using the tag in HTML.
Paths, boxes, text, gradients, and the addition of images can all be drawn
with it. It doesn't have text or borders by default.
Syntax Contents
Take note:
ATTRIBUTES:
Two characteristics are supported by the tag, and they are as follows:
height
This attribute, which has a default value of 150, is used to set the height
of the canvas by taking the value in pixels.
breadth
This property, which has a default value of 300, is used to set the
canvas's width by taking its value in pixels.
FORMS
“Syntax:
“<form>
<!--form elements-->
</form>””
Form Components
There are multiple elements in the HTML
, and each has a distinct function. To define labels for other elements, for
example, use the element. By changing its type attribute, the element, on
the other hand, may be used to record a variety of input data kinds,
including text, passwords, emails, and more. Let's now go over each item
on the list of HTML form elements individually:
CREATING FRAMES:
Using HTML Frames, you can effectively divide your web browser window
into many portions, each of which may load content on its own. A group
of frames included within a frameset tag are used to do this. But it's
crucial to remember that HTML 5 deprecates the tag.
Making Frames
In HTML, the tag is used to create frames rather than the tag. The HTML
document to be loaded into each frame is specified by the tag, which
defines each frame. Horizontal frames are defined by the row attribute,
and vertical frames by the col attribute. Here's an example of how to use
the frameset tag's row attribute to generate three horizontal frames.
cols: In a web browser, vertical frames are created using the cols
attribute. Essentially, the number of columns and their sizes inside the
frameset tag are defined by this attribute. The following methods are
used in the frameset to set the column's width or size:
“Use absolute value in pixel Example:
<frameset cols = "300, 400, 300">”
Use percentage value Example:
“<frameset cols = "30%, 40%, 30%">
Use wild card values: Example:
<frameset cols = "30%, *, 30%">”
* will use the remaining percentage to create the horizontal frame in the
example above.
border: The border width of each frame is specified in pixels by this
frameset tag attribute. When there is no border, zero is utilised.
Example:
“<frameset border="4" frameset>”
frameborder: Use the values 0 and 1 to indicate whether or not a three-
dimensional border should be displayed between the frames. A value of 1
indicates that a border will be there, whereas a value of 0 indicates none.
framespacing :The amount of space between the frames in a frameset
can be specified using the framespacing attribute of the frameset tag.
This basically indicates the value in pixels and can accept any integer
number as an input.
“<framespacing="20">
It means there will be 20 pixel spacing between the frames”
The tag can be used to target older browsers that do not support frames.
Multimedia
HTML5: Introduction
Tags and vector pictures are two of the new visual elements.
To enhance semantic content, add and.
With the "Drag and Drop" feature, an object can be picked up and moved
by dragging it farther.
Elements deleted from HTML 5: Several elements from HTML 5 have been
deprecated; these are mentioned below:
“<acronym>
<applet>
<basefont>
<big>
<center>
<dir>
<font>
<frame>
<frameset>
<noframes>
<isindex>
<strike>
<tt>”
footer: The tag is used to define the footer of an HTML document. This
part contains the footer information (author, copyright, carrier, etc.). The
footer tag is contained in the body tag. HTML 5 introduces the tag. For
the footer elements, there must be a start tag and an end tag.
main: Identifies the most crucial content in a web page or application's
body.”
“Mark In HTML, the tag defines the marked text. It functions to highlight
the particular passage that is contained within the paragraph.
nav: The tag is used to declare the navigational part in HTML documents.
Links on websites are typically organised into parts that let people
navigate the site. These URLs are acceptable to put within your nav tags.
section: It defines a theme-based grouping of content.
details: The tag contains the content/information that is initially hidden
but can be viewed upon user request. You can create an interactive
widget that the user can open and close by using this tag. The details
tag's contents are seen when the set attributes are opened.
summary: The tag defines the element's HTML summary. When the
element is used with it, the element provides the user with a summary.
When the user clicks on the summary, the previously hidden material
inside the element is revealed. The tag was introduced with HTML 5.
The tag requires the opening and closing tags. “
“time: To display the data/time in a human-readable format, use the tag.
Dates and times can also be encoded in a machine-readable format using
this method. Users can add birthday reminders or scheduled events to
their calendars, which is a major benefit, and search engines can
generate more intelligent search results.”
“bdi: The Bi-Directional Isolation is denoted by the tag. It sets one text
apart from another, even if they have different formatting. When user-
generated text has an unclear direction, this tag is used.
wbr: The HTML tag, which stands for word break opportunity, designates
the location within the text that the browser interprets as a line break. It
is typically utilized when a term is overly lengthy and there's a danger the
browser would break lines accidentally in order to fit the text.
datalist: The HTML files' autocomplete functionality is provided by the tag.
It can be utilized with an input tag to make it simple for users to choose
the data and fill out forms.
keygen: In HTML, a key-pair generator field in a form is specified using
the tag. The element's function is to offer a safe method of user
authentication. A private key and a public key are generated upon
submission of a form. The public key is transmitted to the server, and the
private key is kept locally. In order to authenticate users in the future, a
client certificate is generated using the public key.
output: A client-side script, like JavaScript, can utilize the tag in HTML to
display the outcome of a calculation.
progress: This is a representation of a task's advancement. It also
indicates the amount of labor completed and the remaining amount to
download an assignment. Neither the disk space nor the pertinent query
are represented by it.
svg: This stands for Scalable Vector Images.”
“canvas: JavaScript is used to draw images on a web page using the tag
in HTML. Paths, boxes, text, gradients, and the addition of images can all
be drawn with it. It doesn't have a border or text by default.
audio: This describes the audio track or audio material.
embed: Establishes containers for third-party programs, typically a media
player.
source: It lists the and sources.
track: It specifies the and tracks.
video: It describes the content of the video.”
Benefits
True
untrue
Ex:
“<!DOCTYPE html>
<html>
<head>
<style>
h1 {
color: green;
}
</style>
</head>
<body>
<h1 contenteditable="true">
This is an Editable Heading element.
</h1>
</body>
</html>”
To find spelling or grammar errors in the text fields, utilize HTML's Spell
Check tool.
HTML forms can have the Spell Check feature by using the spellcheck
element. The spellcheck attribute is an enumerated attribute that
specifies whether the HTML element will undergo an error check or not.
It's compatible with the "textarea" and "input" fields in HTML.
“Syntax :
“Syntax for spellcheck attribute in an input field in html:
“<input type="text" spellcheck="value">”
How to Disable HTML Form Spell Check To turn off spellcheck, set the
HTML form's spellcheck property to "false". Below is an example HTML
programme that has spellcheck disabled.
Syntax:
<element data-*="value">
section of the personalised attributes
Name of attribute:
The attribute name needs to be at least one character long after the
prefix "data-." It should not contain any capital characters.
“Syntax:
• For storing data in web storage: The key and value both
should be string or number;
LocalStorage.setItem("key", "value"); “
• For getting data from web storage: We will pass the key and
it will return value.
LocalStorage.getItem("key");
Sessions storage:
It is evident that local storage items are kept as key/value pairs; you can
confirm this by looking at the page's elements and then selecting the
Application option to access the local storage.
You can verify that the data is stored in the localStorage of the tab or
window by closing the current tab and returning to the same page, since
the localStorage object does not have an expiration date.
Data is stored on the client side via session storage. The data stored in
the SessionStorage is only visible while the tab is open; if the tab is
closed, the data will also be automatically removed from the
SessionStorage.
“Syntactic Grammar:
To keep information on the web:
SessionStorage.setItem("key", "value");
ondragleave: It happens when the drag is taking place and the mouse
moves away from an element before a legitimate drop target.
Ondragend :It happens when an element has been fully dragged by the
user. “
When a user visits a page that provides a manifest, the browser attempts
to update its cache. To achieve this, it gets a copy of the manifest and
downloads and caches each resource it mentions again, redownloading it
if it has changed since the user agent last viewed it.
switch to
the updated
cache by
using
swapCache(
).
was a 404
or 410
page.
The
manifest
was still
there, but
the page
that
referenced
it didn't
download
correctly.
While
retrieving
the
resources
specified in
the
manifest, a
catastrophic
error
happened.
The attempt
to cache the
application
has failed
Event Interface Dispatched Next events
name when...
since the
manifest
was a 404
or 410
page.
The
manifest
was still
there, but
the page
that
referenced
it didn't
download
correctly.
While
retrieving
the
resources
specified in
the
manifest, a
catastrophic
error
happened.
The attempt
to cache the
Event Interface Dispatched Next events
name when...
application
has failed
since the
manifest
was a 404
or 410
page.
The
manifest
was still
there, but
the page
that
referenced
it didn't
download
correctly.
While
retrieving
the
resources
specified in
the
manifest, a
catastrophic
error
happened.
Event Interface Dispatched Next events
name when...
during the
process of
retrieving
the
resources
listed in the
manifest.
Since the
manifest
was either a
404 or 410
page, the
attempt to
cache the
programme
was
unsuccessfu
l.
The
manifest
remained
intact,
however the
page
referencing
it failed to
download
Event Interface Dispatched Next events
name when...
properly.
A
catastrophic
mistake
occurred
during the
process of
retrieving
the
resources
listed in the
manifest.
Since the
manifest
was either a
404 or 410
page, the
attempt to
cache the
programme
was
unsuccessfu
l.
The
manifest
remained
intact,
however the
Event Interface Dispatched Next events
name when...
page
referencing
it failed to
download
properly.
A
catastrophic
mistake
occurred
during the
process of
retrieving
the
resources
listed in the
manifest.
The
manifest
was
changed
while the
upgrade
was
running.
manifest
was
modified.
Event Interface Dispatched Next events
name when...
Web Communications
XHR and XHR2 with CORS Web Workers Web Sockets Web Messaging
Server Sent Events
standard model for communication events
An event object with a data attribute is sent to every event handler (XHR
excluded). The information provided with the message is included in this
property.
XHR and XHR2 support with CORS These days, XHR support is rather
stable (although IE6 need ActiveXObject to get it started).
XHR2 with CORS: IE8 (via XDomainRequest), Firefox 3.5, Chrome, and
Safari & MobileSafari
postMessage
Although this API is more outdated, it's still rather helpful for
circumventing the XHR same-origin restrictions. One way to communicate
between domains (and origins) is to have a document that can take
onmessage events from your origin, or your website.
Online sockets
In my view, Web Sockets takes Comet's position. Using a browser hack,
Comet allows us to receive real-time server messages. That is directly
provided via the Web Sockets API.
Web sockets are bi-directional sockets that are used to send and receive
messages to and from the server. Unlike other comparable technologies,
Web Sockets allow cross-domain communication and do not impose
same-origin restrictions. This implies that you can run a separate server
for streaming content and host your regular "apps" server. Alternatively,
you may host your own pages and, should your users enable Web Socket
support, connect to a live Twitter stream.
This is a very basic API. "What do you put on the server side?" is the
question I get asked the most. Although I personally prefer Node, you
could use Jetty or a Nginx server instead. Although I'm not an expert on
the latter servers, I can attest to the fact that setting up a Node-based
server is quite easy. I've included a link to the code I used to run the
server in the live demo below.
Onmessage is the model used by this API. It is built with the EventSource
object.
Making sure your server doesn't cut off the client's connection—the
browser—is crucial. Closing the connection causes the API to enter polling
mode, as most examples on the web do (keep in mind that this is the
exact issue I ran with when I first wrote this article).
In polling mode, the API behaves exactly like an XHR poll, with the
onopen firing nonstop.
You can view all of the server-side code here: Observe that custom-
echo.js is operating on a Node.js server. Because it's completing several
tasks, there's a little bit more code than you may anticipate: 1. Managing
file HTTP requests (and hence being able to serve itself) 2. Managing
events sent by the server and maintaining the connection 3. Configuring a
Web Socket server so that each time a new connection is established, all
of the open sessions receive a server-sent event.
Assistance with Server-Sent Events
a. Safari & MobileSafari
b. Chrome
c. Opera11
Web Administrators
One method of starting a new thread of operation within the browser is
using Web Workers. This is included since it's still necessary for you to
connect with your Web Workers, and the way you do so is comparable to
some of the previously covered strategies. But keep in mind that this is
not a way for a client (browser) to communicate with a server. It appears
more like a different browser window is running a specific JavaScript
block.
It's critical to realize that a Web Worker is isolated from other applications
and files and doesn't have access to the DOM. Furthermore, the only ways
you can interact with it are through the onmessage and postMessage
procedures.
Cross-Document Messaging
Data can be sent and received across more than two Web pages.
Communication across domains is also possible since cross-document
messaging is not subject to the Same Origin Policy.
Channel communications
Desktop Notifications
No matter where you are in the globe, you can receive push alerts to
Chrome or Firefox thanks to the html5 notification integration.
Additionally, html5 supports Firefox and Chrome on Android, allowing
integrations that function like native apps without actually requiring
native apps.
Setup to view changes:
You must add the following lines to your configuration.yaml file in order to
enable this platform. Restart Home Assistant after making changes to the
configuration.yaml file for them to take effect. Navigate to Settings >
Devices & services > Entities to see the changes.
Configuration variables:
vapid_pub_key string NEEDED
The email account of your Google account associated with your Firebase
project, see configuring the platform.
vapid_prv_key string required vapid_pub_key string
END OF MODULE I
MODULE II
CSS Introduction
The method of presenting web pages was made simpler with the creation
of the CSS (Cascading Style Sheets) language. It provides guidelines on
the colours, fonts, spacing, and positioning that should be used to
describe a webpage's design and allows you to apply styles to HTML
documents. Thanks to CSS, developers and designers have a great deal of
control over how HTML components are displayed.
HTML employs tags, but CSS makes use of rule sets. To add CSS styles to
the HTML element, selectors are utilised. While CSS is easy to learn and
understand, it provides a great deal of flexibility over how an HTML
document is displayed.
Why is CSS used?
saves time by just needing to create CSS once and then applying it to
several HTML pages.
Easy Maintenance: A single alteration can alter the style worldwide.
Methods of clean coding that improve readability for search engines are
called "search engine friendly."
Improved Styles: Compared to HTML, more properties are available.
Offline Browsing: Web applications can be stored locally by CSS using
offline caching, allowing for offline viewing.
Syntax of CSS
Style rules make up CSS, which the browser interprets and applies to the
appropriate elements. A declaration block and a selector are components
of a style rule set.
// CSS Style
h1 { color: blue; font-size: 12px; }
Where -
Selector - h1
Declaration - { color: blue; font-size: 12px; } “
The HTML element that you wish to style is indicated by the selector.
One or more declarations are contained in the declaration block and are
divided by semicolons.
A colon (:) separates the name of the CSS property from its value in each
declaration.
For Example
CSS
“p {
color: blue;
text-align: center;
}”
CSS Selectors
There are several varieties of CSS selectors, and each selects HTML
elements in a different way. Let's investigate them:”
1. Simple Selectors: These allow you to choose HTML elements by their element
name, id, attributes, and other characteristics.
Categories:
Element Selector: HTML elements can be chosen using the element selector by using
their tag names.
id Selector: An HTML element with a certain id attribute is the target of an id selector.
class Selector: This tool chooses components based on a specific class attribute.
Using CSS (Cascading Style Sheets) with HTML is crucial when creating
user-friendly and aesthetically pleasing websites. There are three main
ways to incorporate CSS: inline, internal, and external into your HTML
projects. Every technique has benefits and ideal applications. This tutorial
will go over each of these techniques in-depth to assist you in selecting the
right strategy for your web development requirements.
2. Inside CSS
By inserting CSS styles inside of
To guarantee that the styles are read before the body content loads, it is
recommended to add the section.
3. Outside CSS “
Using the tag, link the external CSS file to the HTML file. This is done by
creating a second CSS file with a.css extension. Because it keeps the
design and content distinct, this approach allows for superior code
reusability and maintainability, making it the most efficient for large
projects.
Syntactic Grammar:
Background-attachment Property
To fix the background ground image, utilise this property. There will be no
page scrolling for the image.
Syntactic Grammar:
Background-position Property
This property is used to set the image to a particular position.
Syntax :
“body {
background-repeat:no repeat;
background-position:left top;
}”
Font styles:
The text contained in HTML components is styled using CSS fonts. While
font-size, font-weight, and font-style regulate the text's size, thickness,
and style, font-family determines the typeface. When these qualities are
combined, web content's typography and readability are improved.
Syntactic Grammar:
The CSS font-size property determines the size of the font used in an
element.
This is utilised to establish the size of the font for an HTML element. The
font-size can be specified using several units such as pixels, %, em, or
predefined values like small or large.
The syntax refers to the set of rules that dictate the structure and
arrangement of elements in a programming language or command.
The font size is set to the specified value.
Syntax:
font-size: font size value;
Syntax:
“font-stretch: normal|ultra-condensed|extra-condensed|condensed|
semi-condensed|semi-expanded|expanded|extra-expanded|ultra-
expanded;”
Syntax:
font-kerning: auto|normal|none;
Text Formatting:
Syntax:
The Syntax to write this property:
“Selector {
property-name : /*value*/”
Properties:
text. It can be defined using a colour name, hex value, or RGB value.
.
Creating Boxes
The CSS Box Model is a foundational notion in CSS that dictates the
organization and positioning of components on a webpage. By acquiring
knowledge of this model, you will be able to design visually captivating
features that effortlessly adapt to different screen sizes. It is utilized for
the creation and arrangement of the design and structure of web pages.
This essay will explore the fundamental elements of the box model and its
practical consequences.
The CSS Box Model refers to the layout and structure of elements on a
webpage. It consists of four components: the content area, padding,
border, and margin. These components determine the size, spacing, and
positioning of elements on the page.
The CSS box model is a container that encompasses multiple attributes,
such as borders, margins, padding, and the content. These attributes
jointly establish the size and arrangement of an element.
Content can be resized using the width and height property, regardless of
whether it is in the form of text, images, or other media.
Padding refers to the technique of adding extra space around an element,
within the boundaries of any specified border.
Border: The border serves the purpose of concealing the content and any
padding, while also providing the ability to define the style, color, and
width of the border.
Margin refers to the space that is created around an element, specifically
around the border area.
1. Subject Area
3. Border Region
Resides within the space between the padding and margin.
The dimensions of an object are determined by its boundaries.
4. Area of Margin
This action isolates the element from nearby elements.
The dimensions are determined by the width and height of the margin
box.
This value combines attributes of both block and inline, enabling items to
flow in a line while retaining block-level properties. It is beneficial for
constructing adaptable designs.
4. Utilizing the CSS property "display: none":
This attribute conceals the div or container that utilizes it. Applying it to
one of the div elements will enhance clarity in functionality.
Syntax
float: none|left|right|initial|inherit;
Left: The "left" element is positioned on the left side of the container, which
allows the content to wrap around its right side.
Right: The element is positioned to the left within the container, enabling
the content to wrap around its left side.
Inherit: An element acquires the floating attribute from its parent
element. The element inherits its default value.
Features of CSS3
Media Queries
A media query is comprised of a media type that can include one or more
expressions that can be evaluated as either true or false. The query result
is true if the supplied media corresponds to the device type on which the
content is being viewed. The style is applied if the media query evaluates
to true. Put simply, it utilizes the @media rule to incorporate a set of CSS
characteristics, contingent upon specific situations.
Syntax:
@media not | only mediatype and (expression)
{
// Code content
}
To obtain the screen width, as well as the width and height of the viewport
for various devices, we can include a breakpoint. A breakpoint is a specific
point or marker that dictates when the layout should be altered by
introducing new rules and reorganizing elements within the media queries.
There are specific breakpoints, which are not standardized resolutions, that
can be utilized to accommodate the various widths and heights of devices.
Mobile devices typically have a screen width ranging from 320 pixels to 480
pixels.
The recommended screen resolution for tablets or iPads is between 480
pixels and 768 pixels.
Overview of JavaScript
Syntax:
“<script>
// JavaScript Code
</script>”
The history of JavaScript
The creation of this entity took place in 1995 under the supervision of
Brendan Eich, who was employed as an engineer at Netscape at the time.
The initial name of the language was LiveScript, but it was subsequently
changed. JavaScript, unlike the majority of computer languages, lacks the
notion of input or output. The language is specifically designed to function
as a scripting language within a host environment. It is the responsibility
of the host environment to offer the necessary means for interacting with
the external world. The browser is the most prevalent host environment.
Characteristics of JavaScript
Based on a recent poll done by Stack Overflow, JavaScript has been
identified as the most widely used programming language globally.
Due to advancements in browser technology and the integration of
JavaScript into server-side development through Node.js and other
frameworks, JavaScript has significantly expanded its capabilities.
JavaScript offers several functionalities, including:
JavaScript was initially developed primarily for the purpose of
manipulating the Document Object Model (DOM). Historically, websites
were predominantly static in nature. However, with the advent of
JavaScript, the development of dynamic websites became possible.
Constraints of JavaScript
Threats to security: JavaScript can be utilized to retrieve data through
AJAX or by modifying tags that load data, such as <img>, <object>, and
<script>. These attacks are referred to as cross-site scripting attacks. The
attackers inject JavaScript code that is not originally part of the website
into the visitor's browser, allowing them to retrieve the visitor's details.
Performance: JavaScript lacks the same level of efficiency as many
conventional programming languages, resulting in relatively slower
execution for complicated JavaScript programs. However, as JavaScript is
mostly used for executing basic operations within
a web browser, its performance limitations are not typically seen as a
significant hindrance.
JavaScript Functions
A JavaScript function is a code block specifically created to execute a
specific task. A program can reuse a set of instructions by encapsulating
them. Functions in JavaScript can accept parameters, execute
statements, and provide return values. This functionality allows for
effective structure, modularity, and reusability of code in JavaScript
programming.
In JavaScript, a function is created by using the keyword "function"
followed by the function name and parameters enclosed in parentheses.
The portion of the function contained within the curly braces {} is
referred to as the function's body.
Each function must start with the keyword "function" followed by, A user-
defined function name that must be distinct.
A series of parameters surrounded within parenthesis and delimited by
commas,
The body of the function consists of a series of statements contained
behind curly braces {}.
Function Declaration: It defines a function using the function keyword. A
function declaration necessitates the inclusion of a function name.
Syntax:
“function geeksforGeeks(paramA, paramB) {
// Set of statements
}”
Function expression
Syntax:
let geeksforGeeks= function(paramA, paramB) {
// Set of statements
}
Arrow function:
Invoking Functions:
Syntax:
functionName( Value1, Value2, ..);
Events
JavaScript Events are the actions or occurrences that take place in the
browser. They can be activated by different user activities or by the
browser itself.
Syntax:
<HTML-element Event-Type = "Action to be performed"
Syntax:
“<img src="map1.jpg" alt="Cocktails"
The syntax refers to the set of rules that dictate the structure and format
of a programming language or command.
Syntax:
<map name="mymap">
“The rectangle image is defined by the coordinates x1, y1, x2, and y2.
The top left corner is represented by x1 and y1, while the bottom right
corner is represented by x2 and y2, as illustrated in the image.
The circle image will be defined by the coordinates x, y, and r, where x
and y represent the center of the circle and r represents the radius.
A polygon image is defined by a series of coordinates, x1, y1, x2, y2, x3,
y3, x4, y4, and so on. Each pair of x and y values represents the
coordinates of one of the corners of the image, as depicted in the image.
“
JavaScript Objects
The main data type in JavaScript, objects are the building blocks of
contemporary JavaScript. The primitive data types in JavaScript, which
include Number, String, Boolean, null, undefined, and symbol, all store a
single value according to their individual sorts; in contrast, these objects
are very different from each other.
The rules that specify the format and structure of a programming
language or command are referred to as the syntax.
The "new Object(value)" code snippet generates a new object with the
given value.
A certain value is applied when creating an object. There is a key-value
pair for the object with the name "object_name"; the key is "key_name"
and the value is "value".
It is possible to call the Object() function with or without the new
keyword. A novel entity is produced as a consequence of both actions.
Objects function as containers that can hold multiple values at once, but
primitive data types can only store one value per object. The values are
stored as attributes of the object, each with a distinct key. Organising
related functions and data together helps make our code more readable
and well-organized.
Objects are complex, made up of numerous combinations of reference
and primitive data types.
Rather than being uniquely defined for the object itself, which is referred
to as the object's Own property, an object's inherited properties are those
that have been passed down from the object's prototype. We can use the
hasOwnProperty function to find out whether a property directly belongs
to an object. JavaScript data properties have four properties.
Value: The property's monetary estimate or worth.
writable: The property's value may be changed if it is set to true.
window.alert("Hey Geeks");
The Screen Object Model provides details about the user's screen, such as
its dimensions, as part of the Browser Object Model.
The Navigator Object Model provides specific information about the user's
browser and system attributes within the Browser Object Model.
The Location Object Model is responsible for managing the current web
address (URL) and enables modifications within the Browser Object
Model.”
JQuery – Introduction
Using CSS selectors, one may identify certain elements in the Document
Object Model (DOM) and manipulate them using jQuery functions. This
involves locating a group of elements in the DOM and performing actions
on that group.
Applying a sequence of jQuery functions to a group of items
Utilizing the jQuery wrapper and implicit iteration
Implementing the jQuery (JavaScript) library on an HTML webpage
There are multiple methods to initiate the use of jQuery on your website.
Utilize the content delivery network (CDN) provided by Google or
Microsoft to incorporate a specific version of jQuery.
JQuery Selectors
The jQuery function will choose the HTML element with the specified tag
name. For instance, the selector $(‘p’) will choose all the paragraphs.
The jQuery function will choose the HTML tag that matches the specified
ID. It is crucial to emphasize that each element must have a unique id.
For instance, the selector $(#gfg) will specifically target the HTML
element that has the identifier "gfg".
The jQuery Tag Class will choose the tag that has the specified class. For
instance, the selector $(.abc) will target all the classes that have the
name abc.
Events
$(selector).method(function)
The syntax refers to the set of rules that dictate the structure and
arrangement of elements in a particular programming language or
system.
The method function is applied to the element(s) selected by the selector.
At this location We will examine fundamental events and their
corresponding implementation through illustrative examples.
Event for jQuery click() function
jQuery click() is a mouse event that is activated when the mouse pointer
is used to click on an element.
The syntax
$(selector).click(function);
refers to the set of rules that dictate the structure and format of a
programming language or command.
jQuery dblclick is a mouse event that occurs when the mouse pointer is
double-clicked on an element.
The syntax
$(selector).dblclick(args);
refers to the set of rules that dictate how words and symbols are
combined to form valid expressions or statements in a programming
language.
The $(selector) function is used to select elements in jQuery.Execute the
function "dblclick" with the argument "args".
The val() function is utilized to assign or retrieve the value of form fields.
Introduction to AJAX
Introduction: This lesson aims to provide a concise overview of Ajax and its
applications. Prior to comprehending these terminology, it is necessary to
examine a few practical examples that effectively illustrate the capabilities
of Ajax. Platforms such as Facebook, Instagram, and Twitter are known for
their ability to display a continuous stream of updates, allowing users to
easily view and interact with posts. By simply clicking the "like" button,
users can express their approval of a post, and the total number of likes is
instantly updated without the need to refresh the page. Now consider the
scenario where, when clicking the like button, the entire website would
reload, resulting in similar operations. Now the question arises as to
whether clicking the button again is necessary for such a minor operation
that requires the entire web page to reload. Definitely not, as it is quite
unlikely that anyone would engage in such a nonsensical action (in the
second scenario). Therefore, this aspect of "like" is highly beneficial as it
serves as a preventive measure.
The refreshing of the entire webpage.
It transmits just essential data to the server and displays it to the end
user, specifically the growth in the number of likes.
Let's examine another scenario when you go to Google to look for
anything. Typically, it is noticed that when one begins typing the desired
terms for a search, numerous suggestions are displayed in the search bar.
From where do they originate? Certainly not from the perspective of the
client. The results once again demonstrate the efficacy of server
communication without the need for page reloading.
There are several cases that can be regarded in a similar manner. Ajax is
the driving force behind the entire power at work. Let's briefly examine
Ajax and its implementation.
END OF MODULE II
MODULE III
Getting Started with Bootstrap
Creating Responsive Layouts Using Bootstrap CSS - Basic HTML structure for
Bootstrap
The .row and .col classes are utilized to generate and control the rows
and columns of the grid, respectively.
The bootstrap grid system consists of five classes that are determined by
the width of the device or browser.
For compact devices
col-lg: It has a screen width that is either equal to or larger than 992px.
col-xl: It possesses a screen width that is either equal to or exceeds
1200px.
Note: In this context, the abbreviations sm, md, lg, and xl represent the
different sizes of devices, specifically small, medium, large, and extra-
large.
Fundamental Framework:
“<div class="container">
<div class="row">
<div class="col-lg">
column-1
</div>”
“ <div class="col-lg">
Column-2
</div>
</div>
</div>”
This is column-1.
Responsive classes
Utility classes for responsiveness are defined for five distinct size
categories:
Rendering images
“To tag, add the.img-fluid class. This pertains to the.img-fluid class: .img-
rounded class: max-width: 100% | height: auto onto the image
“The.img-circular class turns the image's form into a circle. (IE8 does not
support rounded corners.).img-thumbnail class:
Grid Structure: In the last tutorial, we have learnt about Bootstrap and
how to install it. However, we're going to begin by reading this post to
understand about Bootstrap. We'll talk about the Bootstrap Grid System
in this essay.
Grid System: The Bootstrap Grid System allows for the display of up to 12
columns across a page. You can use each one independently or all of
them together for wider columns. You can use any set of numbers that
sum up to 12. Any combination of widths can be used, such as four
columns of width three or twelve columns of width one.
Grid Classes: To design layouts with more flexibility, the Bootstrap grid
system offers the following four classes:
Nesting Columns: We must create a new row and set of columns in order
to nest columns inside of columns. A collection of columns in nested rows
should sum up to 12 or less.
You may find forms on almost any website you visit. It is frequently used
to collect user data. The system has a number of interactive controls that
let users enter information. The controls are contained in the tag and are
modifiable by changing their attributes to different values.
“Text Fields are single-lined input fields that only allow the entry of text
on a single line. “
“Password fields are unique text fields that display special characters,
such as an asterisk or a bullet, instead of the actual characters entered by
the user. “
“Textarea: They are fields that can contain many lines of text.
Checkboxes allow for the selection of several alternatives from a range of
choices.
Radio buttons are a type of input element that allows users to choose
among multiple options, with the restriction that only one option can be
selected at a time.
Submit Buttons are utilized to facilitate the submission of user-entered
form data. “
To incorporate this form into your website using bootstrap, simply include
the jquery and bootstrap libraries as scripts in your HTML code.
“<script
src=”https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js”></sc
ript>”
“<script
src=”https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js
”></script>”
Insert the given bootstrap stylesheet link in the HTML document's head
section to allow the utilization of different bootstrap classes for formatting
the form and its controls.
“<link rel=”stylesheet”
href=”https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min
.css”>”
The content comprises of design templates for buttons, forms, fonts, and
other interface elements that are based on HTML and CSS. Additionally,
optional JavaScript extensions are available. A website can have forms,
lists, headers, tables, images, and buttons, among other components. All
of these core HTML elements have been improved and made more
customisable by expandable classes.
“<link
href=”https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.
min.css” rel=”stylesheet” integrity=”sha384-
1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6
jIW3″ crossorigin=”anonymous”>”
• JS:
“<script
“src=”https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bu
ndle.min.js” integrity=”sha384-
“ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nb
Tov4+1p” crossorigin=”anonymous”></script>”
“2. Utilizing package managers: The bootstrap package can be
incorporated into your project by use package managers:
npm, yarn, RubyGems, and composer are all package managers. Retrieve
the source files: “
To incorporate the bootstrap package, you can obtain the source files of
bootstrap and include them in your project. I have included the hyperlink
to access the source files in the references section. You may proceed with
the check-in at that location. “
Glyphicons
Bootstrap Glyphicons are a collection of compact icons that are based on
glyphs and are used to improve user interfaces. They provide a diverse
range of symbols for typical operations and objects, enabling enhanced
visual representation and functionality in online applications.
Use cases:
“<link rel=”stylesheet”
href=”https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.
min.css”> <script
““src=”https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.j
s”></script> <script
“src=”https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.mi
n.js”></script>”
To load our CSS, it is necessary to include the Bootstrap3 and jQuery CDN
in the tag before any other stylesheets.”
Standard Navigation Bar: The standard navigation bar, formatted with the
"navbar" class, consists of a logo, navigation links, and dropdown menus.
The navigation bar is constructed using the element and initialized using
the classes "navbar" and "navbar-default".
Alerts
Syntax:
....
</div>”
Class for the buttons on a toolbar that are organized in a button group.
MODULE IV
INTRODUCTION TO PHP
Hypertext Preprocessor is shortened to PHP. PHP is a web development-
specific programming language meant to operate on servers. Being open-
source, it is available for free usage and download. It really is easy to use
and comprehend. PHP files are denoted with the ".php" suffix.
PHP was introduced in the first version, while Rasmus Lerdorf contributed
to the succeeding ones. Since the language is interpreted, a compiler is
not required.
PHP's features
The server is used to run PHP code.
Numerous databases can be utilised with it, including Oracle, Microsoft
SQL Server, MySQL, PostgreSQL, Sybase, and Informix.
It has the strength to handle content management systems such as
WordPress and has the capability to regulate user access.
Most widely used protocols are compatible with it, including FTP, IMAP,
HTTP Digest, and HTTP Basic.
PHP is also the engine behind websites like facebook.com and yahoo.com.
The key reasons for this are that PHP can easily be embedded in HTML
files and can produce HTML code inside of PHP files.
Because PHP supports dynamic typing, you can use variables without
explicitly defining their data type.
Cross-Platform: PHP runs on several platforms, making it compatible with
a wide range of operating systems.
Open Source: PHP is a free and open-source language that can be used
and distributed without restriction. This promotes a sizable developer
community, which aids in its expansion and advancement.
Simple to Learn: Since PHP's syntax is comparable to that of C and other
programming languages, developers—especially those with prior
programming experience—should find it quite simple to pick up.
Web Integration: PHP is integrated into HTML and is made especially for
web development. It allows for the easy integration of multiple web
technologies, making it easier to create dynamic and interactive web
pages.
Database Support: MySQL, PostgreSQL, SQLite, and other databases are
all well supported by PHP. This facilitates database connectivity and
interaction, which is essential for many web applications.
Cross-Platform Compatibility: PHP operates across a number of operating
systems, including Windows, Linux, macOS, and others. It is not
dependant on any particular platform. This guarantees interoperability in
many settings.
Generous Community and Documentation: The PHP development
community is both sizable and vibrant. For developers, finding answers
and getting assistance when needed is made easier by the wealth of
online tools, tutorials, and documentation.
CMS and frameworks: Well-known PHP frameworks like CodeIgniter,
Symfony, and Laravel offer pre-built features and modules that speed up
development. Furthermore, popular content management systems (CMS)
like WordPress and Joomla are supported by PHP.
Server-Side Scripting: By running PHP scripts on the server, the client's
workload is lessened. The ability to script on the server side is essential
for creating dynamic content and handling server-side operations.
Community Support: Regular updates, security patches, and
enhancements are made possible by the active participation of the PHP
community in the language's development.
The drawbacks of PHP
PHP has been under fire for having inconsistent function names and
parameter ordering. Developers may become confused as a result,
particularly if they are combining older and newer features.
“Data Types define the type of data a variable can store. PHP allows
eight different types of data types. All of them are discussed below.
There are pre-defined, user-defined, and special data types.
The predefined data types are:”
• “Boolean
• Integer
• Double
• String
The user-defined (compound) data types are:
• Array
• Objects
The special data types are:
• NULL
• Resource”
PHP Constants: PHP The identifiers that don't change are called
constants. Typically, it remains unchanged while the script runs. Case
matters for them. Constant identifiers are always capitalized by default.
An underscore or letter is typically used as the first character in a
constant name, followed by a string of characters and numbers. There's
no need to use the $ symbol when writing a constant. The value of a
constant can be obtained using the constant() function.
1. The $ symbol is not required when using PHP constants. The $ symbol
is used in PHP variables.
2. The PHP constant's data type cannot be altered while the script is
running. It is possible to modify the PHP variable's data type while the
script is running.
3. Once defined, a PHP constant cannot be redefined. It is possible for a
PHP variable to be redefined or undefined.
Expressions
Regular expressions, or regexes as they are more widely known, are text
strings that contain a series of characters that represent a unique search
pattern. In the field of programming, they are primarily utilized in
algorithms that match ill-defined patterns to accomplish pertinent tasks.
Regexes are sometimes thought of as a miniature computer language that
enable text string parsing through the use of pattern notation. Since the
precise character order is uncertain in advance, regex is used to retrieve
the necessary strings using a pattern definition.
[^]: It locates items that are out of range; for instance, [^abc] indicates
that an, b, or c are not present. “
{n, m}: It denotes atleast n but not more than m times for example
n{2, 4} means 2 to 4 of n.
\t It represents a tab; “
“\v It represents a vertical tab;
\f It represents a form feed. “
“\xxx indicates the octal character hh”
Def of Function
“preg_match(): This function looks through a string for a given pattern. If
a pattern is found, it returns true; if not, it returns false.”
“preg_match_all: This function compares the string to all instances of the
string pattern. This feature is really beneficial for searching and
replacing.”
ereg replace(): This function looks for a particular string pattern and, if
one is found, replaces the original string with the new string. “
“^: It matches any text that begins with geeks. /\geeks/ matches the
beginning of the string.”
$~: It corresponds to the pattern of strings at the end of the
string.~/com$/ corresponds to strings that finish in com, like google.com,
etc. “
“+\.[a-z]{2, 6}$/ After escaping the dot, it matches any lowercase letter
at the end of the string with a length between 2 and 6. “
Control Structures
“if statement
• if…else statement
• if…elseif…else statement
• switch statement
if Statement: We are able to set a condition with this sentence. The code block
wrapped in the if clause will execute if the condition is TRUE.
Syntax :
if (condition){
}”
“
“if…else Statement: We knew that an if statement would execute the
block of code inside it if the condition held, that is, if TRUE. However,
what would happen if we wanted to take an action but the condition
wasn't true? Here's when things become interesting. Blocks are executed
if a condition is TRUE, else they are not executed.
Syntax:
“if (condition) {
}”
“
”
Syntax:
“switch(n) {
case statement1:
code to be executed if n==statement1;
break;
case statement2:
break;
case statement3:
break;
case statement4:
break;
......
default:
“Syntax:
(condition) ? if TRUE execute this : otherwise execute this;”
Functions
A function is a section of code that is written in a program to carry out a
certain purpose. To gain a better grasp of how functions operate, we can
draw comparisons between computer functions and real-world office
workers. Let's say the manager requests that his staff member compute
the yearly budget. How then will this process come to an end? The worker
will gather data from the supervisor regarding statistics, compute the
budget, and provide the findings to the supervisor. Functions operate in a
comparable way. They accept arguments in the form of information, run a
block of commands or carry out operations on the parameters, and then
deliver the outcome.
There are two main categories of functions that PHP offers:
Reusability: We can simply include common code inside functions and call
them as needed if we want to use them at different points in the program.
As a result, repeating a single code takes less time and effort. This can be
accomplished by importing the PHP file containing the function into
another program or by doing it directly within one application.
A function is any name that ends in both an open and closed parenthesis.
Grammar:
“function function_name(){
Syntax:
executable code;
}”
There are two methods that PHP lets us provide an argument into a
function:
PHP arrays are a form of data structure that allow us to store several
elements of the same or different data types under a single variable,
saving us the hassle of having to establish separate variables for each
type of data. The arrays allow one to access a list of elements with similar
kinds by using an index or key.
Let's say we wish to print five names after storing them. The use of five
separate string variables makes this task simple. However, it would be
quite challenging for the user or developer to construct so many different
variables if the number increased to 100 instead of 5. Arrays come into
play here, enabling us to store all of the elements in a single variable and
provide convenient access through the use of keys or indexes. In PHP, an
array is formed with the array() function.
PHP Indexed or Numeric Array Types: An array where values are stored
linearly and assigned a numerical index.
Associative arrays are arrays having a string index in which each value
can be given a unique key in lieu of linear storage.
Multidimensional arrays are made up of one or more arrays that can be
accessed using a variety of indices.
These array types are comparable to indexed arrays, but they do not
require linear storage; instead, each value can be allocated a user-defined
string key.
Arrays in several dimensions
All it takes to utilize PHP in HTML code is to add a PHP tag; no further
effort is required.
Example 1: Open the file in any editor first, then type the HTML code into
it as needed. If PHP code needs to be added, it may be done very easily
by putting tags in between and adding your PHP code as needed.
With PHP version 5.0, object-oriented programming features were added.
One of the most widely used programming paradigms, object-oriented
programming is built on the idea of objects and classes.
Try and catch...Lastly, discover how to use the finally block to clear up
the resources in the event of an error.
Throw an exception: this tutorial will show you how to use the throw
statement to throw an exception.
Set an Exception Handler: This tutorial will walk you through setting a
global exception handler to handle uncaught exceptions using the
set_exception_handler method.
Object/Class Functions
END MODULE IV
MODULE V
The user's information is sent to the server via HTML forms, which then
return the results to the browser. For instance, you can utilise form
processing to gather user information if you wish to offer well wishes and
obtain the specifics of website users. Next, either the client-side or the
server-side can validate the data. The customer receives the final result
using the appropriate web browser. Use the form tag to construct an
HTML form.
Form Tag and description attributes:
Textbox: Textboxes let users enter text in one line and can be used to
retrieve values like names, menu items, and more.
Textarea: Textareas enable multi-line input from the user, which can be
used to retrieve values like a message, address, or other data.
DropDown: The user can choose a value from a list of values using a
dropdown or combobox.
Radio Buttons: With radio buttons, the user can choose just one choice
from the available possibilities. “
“CheckBox: This feature lets the user choose from the list of available
options more than once.
Buttons: The controls that can be clicked to submit the form are called
buttons. “
Making a basic HTML form: The input tag is used in the design of all
the form controls mentioned above, according to the tag's type attribute.
The script below doesn't use any event handling when the form is
submitted. Event handling is the term used to describe the actions taken
upon form submission. PHP or JavaScript can be used to implement these
event handling techniques. JavaScript, however, only offers client-side
validation. Therefore, PHP may be used to handle forms.
Form validation: This process verifies that the user has entered the
necessary information. HTML components can be used for simple
validation. For instance, the email address text box in the script above
has the type value set to "email," preventing users from inputting invalid
email addresses. In the script mentioned above, each form field has an
obligatory property that informs the user not to leave any field blank
before submitting the form. Form processing in PHP uses the following
arrays and methods:
PHP Form Processing: The HTML script above is rewritten with the
functions and array specified previously. The script has been modified to
ensure that all form fields are validated. If no problems are found, the
received information is displayed in tabular form.
GET POSTING
The form is prepared for submission after client-side validation. The GET
and POST methods are used to communicate the form data to the server
after it has been submitted. The form data will first be sent to the server
via the GET method, and then it will be sent via the POST method.
Ultimately, we will comprehend the distinctions between the two HTTP
protocols that are employed to transmit the form data.
Using the 'GET' HTTP method to send the form data: The GET method is
used to request data from designated resources. It requests resources
from the server by sending an empty body there. The data sent by the
server is appended to the page's URL if the form data is sent via the GET
method. There are various length constraints on its demands. It's not
employed for alteration.
Using the 'POST' HTTP method to send the form data: To create and
update a resource, data is sent to a server via the POST method. Instead
of appending the page URL to the HTTP request, the requested data is
attached to the request body when using the POST method. There are no
length limitations on its request.
On the user's computer, cookies are saved as files and can stay there for
a predetermined amount of time unless the user decides to remove them.
Cookies can only be four KB or less in size.
Range Limited to the PHP script that generated themAny script on the
domain that produced them can access them.
Persistence is erased when a user closes their browser and is kept in
memory on the server.saved as files on the user's computer, where they
will stay unless the user deletes them after a predetermined amount of
time.
Dimensions can hold as much information as the user's session storage
space will allow (typically several megabytes)Size restriction, usually no
more than 4KB
Safety Because they are kept on the server and are not accessible by the
user, they are more secure.Because they are kept on the user's
computer, they are less secure.
What is MySQL?
With the help of the mysql_close() PHP function, you can always detach
from the MySQL database.
Object-Oriented MySQLi
Prepared Statement, Database Transactions.
reduced overhead associated with parsing the statement each time it's
run. Large quantities of nearly identical statements are typically
processed by database systems, with literal or variable values only
changing in clauses like WHERE for queries and deletes, SET for updates,
and VALUES for inserts.
defense against attacks using SQL injection. Unescaped SQL quotes and
delimiter characters may be present in the parameter values.
Repaired Statements in Programs for Applications
Client programming interfaces, such as the MySQL C API client library for
C programs, MySQL Connector/J for Java programs, and MySQL
Connector/NET for.NET programs, allow you to use server-side prepared
statements. For instance, the prepared statement API offered by the C
API consists of a collection of function calls. View the Prepared Statement
Interface for C API. By linking in the C client library, other language
interfaces can enable prepared statements that use the binary protocol.
One such example is the mysqli extension, which is available in PHP 5.0
and later.
When you don't have access to a programming interface, you can still use
it.
Any program that can submit SQL statements to the server for execution,
like the MySQL client program, can use it.
Even if the client is utilizing an outdated client library version, you can
still use it.
The purpose of QL syntax for prepared statements is to be applied in
scenarios like these:
when you don't have access to a programming API that supports prepared
statements, to use them.
In order to submit a bug report, you must build a test case that uses
prepared statements to replicate an issue.
ALTER TABLE
ALTER USER
ANALYZE TABLE
CACHE INDEX
CALL
CHANGE MASTER
CHECKSUM {TABLE | TABLES}
COMMIT
{CREATE | DROP} INDEX
{CREATE | RENAME | DROP} DATABASE
{CREATE | DROP} TABLE
{CREATE | RENAME | DROP} USER
{CREATE | DROP} VIEW
DELETE
DO
FLUSH {TABLE | TABLES | TABLES WITH READ LOCK | HOSTS |
PRIVILEGES
| LOGS | STATUS | MASTER | SLAVE | USER_RESOURCES}
GRANT
INSERT
INSTALL PLUGIN
KILL
LOAD INDEX INTO CACHE
OPTIMIZE TABLE
RENAME TABLE
REPAIR TABLE
REPLACE
RESET {MASTER | SLAVE}
REVOKE
SELECT
SET
SHOW BINLOG EVENTS
SHOW CREATE {PROCEDURE | FUNCTION | EVENT | TABLE | VIEW}
SHOW {MASTER | BINARY} LOGS
SHOW {MASTER | SLAVE} STATUS
SLAVE {START | STOP}
TRUNCATE TABLE
UNINSTALL PLUGIN
UPDATE
END MODULE V
.
.