SlideShare a Scribd company logo
Pune Vidyarthi Griha’s
COLLEGE OF ENGINEERING, NASHIK
“SERVER SIDE
TECHNOLOGYIES - II”
By
Prof. Anand N. Gharu
(Assistant Professor)
PVGCOE Computer Dept.
16 Feb 2020Note: Thematerial to preparethis presentation hasbeentaken from internet andare generatedonly
for students referenceandnot for commercialuse.
Outline
PHP
WAP & WML,
AJAX
PHP
Outline
Introduction to PHP,
Features,
sample code,
PHP script working,
PHP syntax,
conditions & Loops,
Functions,
String manipulation,
Arrays & Functions,
Form handling,
Cookies & Sessions,
using MySQL with PHP,
Introduction toPHP
• PHP is an acronym for "PHP: Hypertext Preprocessor"
• PHP is a widely-used, open source scripting language
• PHP scripts are executed on the server
• PHP is free to download and use
• What is a PHP File?
• PHP files can contain text, HTML, CSS, JavaScript, and PHP code
• PHP code are executed on the server, and the result is returned
to the browser as plain HTML
• PHP files have extension ".php"
• What Can PHP Do?
• PHP can generate dynamic page content
• PHP can create, open, read, write, delete, and close files on the server
• PHP can collect form data
• PHP can send and receive cookies
• PHP can add, delete, modify data in your database
• PHP can be used to control user-access
• PHP can encrypt data
• With PHP you are not limited to output HTML. You can output images,
PDF files, and even Flash movies. You can also output any text, such as
XHTML and XML.
Introduction toPHP
Features /Advantages of PHP
• PHP runs on various platforms (Windows, Linux, Unix, Mac OS X,
etc.)
• PHP is compatible with almost all servers used today (Apache, IIS, etc.)
• PHP supports a wide range of databases
• PHP is free. Download it from the official PHP resource:
www.php.net
• PHP is easy to learn and runs efficiently on the server side.
• Advantages :
• Simple , Interpreted , Faster , Open Source , Platform Independent ,
Efficiency, Flexibility.
PHP Syntax
• Basic PHP Syntax
• A PHP script can be placed anywhere in the document.
• A PHP script starts with <?php and ends with ?>:
• <?php
// PHP code goes here
?>
• The default file extension for PHP files is ".php".
sample code–
Example1toprintHelloWorldusingPHP
• <!DOCTYPE html>
<html>
<body>
<h1>My first PHP page</h1>
<?php
echo "Hello World!";
?>
</body>
</html>
sample code–
<?php
$txt = "Hello world!";
$x = 5;
$y = 10.5;
echo $txt;
echo "<br>";
echo $x;
echo "<br>";
echo $y;
?>
</body>
</html>
"Hello world!"
5
10.5
Example2 variable declaration
<html>
<body>
Out Put
PHPVariables
• Rules for PHP variables:
• A variable starts with the $ sign, followed by the name of the variable
• A variable name must start with a letter or the underscore character
• A variable name cannot start with a number
• A variable name can only contain alpha-numeric characters and
underscores (A-z, 0-9, and _ )
• Variable names are case-sensitive ($age and $AGE are two different
variables)
sample code–
Example3-Tooutputtextandavariable
• <html>
<body>
<?php
$txt = "W3Schools.com";
echo "I love $txt";
?>
</body>
</html>
• <html>
<body>
<?php
$txt = "W3Schools.com";
echo "I love " . $txt . ;
?>
</body>
</html>
Program for addition oftwo numbers
• <body>
• <?php
• $n1=5;
• $n2=6;
• $sum=$n1+$n2;
• Echo “Summation is”.$sum;
• ?>
• </body>
PHP Variables Scope
• In PHP, variables can be declared anywhere in the script.
• The scope of a variable is the part of the script where the variable
can be referenced/used.
• PHP has three different variable scopes:
• local
• global
• static
PHP VariablesScope-
Global and LocalScope
Example
<?php
$x = 5; // global scope
function myTest() {
echo "Variable x inside function is: $x";
}
myTest();
echo "Variable x outside function is: $x”;
?>
Out put
• Variable x inside function is:
• Variable x outside function is: 5
A variable declared outside a function has a GLOBAL SCOPE and can only
be accessed outside a function:
PHP VariablesScope-
Global and LocalScope
Example
<?php
function myTest()
{
$x = 5; // local scope
echo "Variable x inside function is: $x";
}
myTest();
echo "Variable x outside function is: $x";
?>
Out put
• Variable x inside function is: 5
• Variable x outside function is:
A variable declared within a function has a LOCAL SCOPE and can only be
accessed within that function:
PHP VariablesScope-
The globalKeyword
Example
<?php
$x = 5;
$y = 10;
function myTest() {
global $x, $y;
$y = $x + $y;
}
myTest(); // run function
echo $y; // output the new value for variable $y
?>
Out put
15
The global keyword is used to access a global variable from within a
function
PHP ComparisonOperators
Operator Name Example Result
== Equal $x == $y Returns true if $x is equal to $y
=== Identical $x === $y
Returns true if $x is equal to $y, and they are
of the same type
!= <> Not equal $x != $y Returns true if $x is not equal to $y
>
Greater
than
$x > $y Returns true if $x is greater than $y
< Less than $x < $y Returns true if $x is less than $y
>=
Greater
than or
equal to
$x >= $y
Returns true if $x is greater than or equal to
$y
<=
Less than
or equal to
$x <= $y Returns true if $x is less than or equal to $y
Outline
Introduction to PHP,
Features,
sample code,
PHP script working,
PHP syntax,
conditions & Loops,
Functions,
String manipulation,
Arrays & Functions,
Form handling,
Cookies & Sessions,
using MySQL with PHP,
Conditions andLoops
• If else
• Elseif ladder
• Switch case
Conditional
Statements
• While
• Do while
• For
• Foreach
Loop
Statements
If…else
Syntax
• If(condition)
• statements;
• else
• statements;
Example
• <body>
• <?php
• $n=5;
• If($n%2 == 0)
• Echo “Number is Even”;
• Else
• Echo “Number is Odd”;
• ?>
• <body>
Elseif
Syntax
• If(condition)
• statements;
• Elseif(condition)
• statements;
• Else
• statements;
Example
• <body>
• <?php
• $day=date(“l”);
• If($day == “Saturday”))
• Echo “Happy Weekend”;
• Elseif($day == “Sunday”))
• Echo “Happy Sunday”;
• Else
• Echo “Nice Working day”;
• ?>
• <body>
Switchcase
Syntax
• Switch(expression)
• {
• Case constant_expression:
• statements;
• break;
• Default:
• statements;
• }
Example
•
• <?php
$favcolor = "red";
switch ($favcolor) {
case "red":
echo "Your favorite color is red!";
break;
• case "blue":
echo "Your favorite color is blue!";
break;
default:
echo "Your favorite color is neither
red, blue!";
}
?>
WhileLoop
Syntax
• while (condition is true) {
• code to be executed;
• }
Example
• <?php
$x = 1;
while($x <= 5) {
echo "The number is: $x <br>";
$x++;
}
?>
Do-WhileLoop
Syntax
• do {
code to be executed;
} while (condition is true);
Example
• <?php
$x = 1;
do {
echo "The number is: $x <br>";
$x++;
} while ($x <= 5);
?>
ForLoop
Syntax
• for (init counter; test counter;
increment counter)
• {
code to be executed;
}
{
Example
• <?php
for ($x = 0; $x <= 10; $x++)
echo "The number is: $x <br>";
}
?>
ForeachLoop
Syntax
• foreach ($array as $value) {
code to be executed;
}
{
Example
• <?php
$colors = array("red", "green", "blue");
foreach ($colors as $value)
echo "$value <br>";
}
?>
Outline
Introduction to PHP,
Features,
sample code,
PHP script working,
PHP syntax,
conditions & Loops,
Functions,
String manipulation,
Arrays & Functions,
Form handling,
Cookies & Sessions,
using MySQL with PHP,
User DefinedFunctions
• function functionName()
{
code to be executed;
}
Syntax Example
• <body>
<?php
function writeMsg() {
echo "Hello world!";
}
writeMsg();
?>
</body>
ParameterizedFunctions
• <html>
• <body>
• <?php
function Add($a,$b) {
$sum=$a+$b;
echo “Sum is $sum";
}
Add(10,20);
?>
• </body>
• </html>
Example Output
• Sum is 30
Returningvalue throughfunction
• <html>
• <body>
• <?php
function Add($a,$b) {
$sum=$a+$b;
return $sum;
}
$Result=Add(10,20);
echo “Sum is $Result";
?>
• </body>
• </html>
Example Output
• Sum is 30
Setting default valuesfor function
parameter
Example
<html>
<body>
<?php
function Add($a,$b=300)
{
$sum=$a+$b;
echo “Sum is $sum";
}
Add(10);
Add(10,20);
?>
</body>
</html>
Output
• Sum is 310
• Sum is 30
Dynamic FunctionCalls
Example
<<html>
<body>
<?php
function Hello() {
echo "Hello How R U?";
}
$fh = "Hello";
$fh();
?>
</body>
</html>
Output
Hello How R U?
Outline
Introduction to PHP,
Features,
sample code,
PHP script working,
PHP syntax,
conditions & Loops,
Functions,
String manipulation,
Arrays & Functions,
Form handling,
Cookies & Sessions,
using MySQL with PHP,
StringManipulation
String
Manipulation
Function
Description Example
strlen() returns the length of a
string
<?php
echo strlen("Hello world!"); ?>
// outputs 12
str_word_count() counts the number of
words
<?php
echo str_word_count("Hello world!"); ?>
// outputs 2
strrev() reverses a string <?php
echo strrev("Hello world!"); ?>
// outputs !dlrow olleH
strpos() searches for a specific
text within a string.
<?php
echo strpos("Hello world!", "world"); ?>
// outputs 6
str_replace() replaces some
characters with some
other characters in a
string.
<?php
echo str_replace(“Ram", “Holly", "Hello Ram");
?>
// outputs Hello Holly!
Outline
Introduction to PHP,
Features,
sample code,
PHP script working,
PHP syntax,
conditions & Loops,
Functions,
String manipulation,
Arrays & Functions,
Form handling,
Cookies & Sessions,
using MySQL with PHP,
Arrays
• Create an Array in PHP
• In PHP, the array() function is used to create an array:
• array();
• In PHP, there are three types of arrays:
1. Indexed arrays - Arrays with a numeric index
2. Associative arrays - Arrays with named keys
3. Multidimensional arrays - Arrays containing one or more
arrays
Arrays- IndexedArrays
• There are two ways to create indexed arrays:
1. The index can be assigned automatically as below :
• $cars = array("Volvo", "BMW", "Toyota");
2. The index can be assigned manually:
• $cars[0] = "Volvo";
$cars[1] = "BMW";
$cars[2] = "Toyota";
Arrays-IndexedArrays
• To create and print array
• Example-
• <?php
$cars = array("Volvo", "BMW", "Toyota");
echo "I like " . $cars[0] . ", " . $cars[1] . " and " . $cars[2] . ".";
?>
• Get The Length of an Array - The count() Function
• Example
• <?php
$cars = array("Volvo", "BMW", "Toyota");
echo count($cars);
?>
Arrays-IndexedArrays
• Loop Through an Indexed Array
• Example
• <?php
$cars = array("Volvo", "BMW", "Toyota");
$arrlength = count($cars);
for($x = 0; $x < $arrlength; $x++) {
echo $cars[$x];
echo "<br>";
}
?>
Arrays- AssociativeArrays
• Associative arrays are arrays that use named keys that you
assign to them.
• There are two ways to create an associative array:
1. $age = array("Peter"=>"35", "Ben"=>"37", "Joe"=>"43");
2. $age['Peter'] = "35";
$age['Ben'] = "37";
$age['Joe'] = "43";
Arrays- AssociativeArrays
• Example
• <?php
$age = array("Peter"=>"35", "Ben"=>"37", "Joe"=>"43");
echo "Peter is " . $age['Peter'] . " years old.";
?>
• Loop Through an Associative Array
• Example
• <?php
$age = array("Peter"=>"35", "Ben"=>"37", "Joe"=>"43");
foreach($age as $x => $x_value) {
echo "Key=" . $x . "Value=" . $x_value;
echo "<br>";
}
?>
Arrays- MultidimensionalArrays
• PHP understands multidimensional arrays that are two, three, four, five, or
more levels deep.
• PHP - Two-dimensional Arrays
• A two-dimensional array is an array of arrays
• First, take a look at the following table:
• Example
• $cars = array
(
array("Volvo",22,18),
array("BMW",15,13),
);
Name Stock Sold
Volvo 22 18
BMW 15 13
FunctionsonArray
• print_r() –Prints all elements of an array in standard format
• extract()-Converts array into variables
• compact()-Converts group of variables into array
• is_array() –to check weather a particular elements is an array or
not.
• sort() - sort arrays in ascending order
• rsort() - sort arrays in descending order,
• asort()-sorts associative arrays in ascending order, on values
• ksort()-sorts associative arrays in ascending order,on keys
• arsort()- sorts associative arrays in descending order,on values
• krsort()-sorts associative arrays in descending order,on keys
Functionson Array:print_r()
Example
<?php
$a =
array ('a' => 'apple', 'b' => 'banana‘)
print_r ($a);
?>
Out Put
Array
(
[a] => apple
[b] => banana
)
Functions on Array:extract()
Example
<?php
$my_array = array(“Rno" => “1",
“ Name" => “Anna",
“Class" => “TE Comp");
extract($my_array);
echo $Rno;
echo $Name;
echo $Class;
?>
Out Put
1
Anna
TE Comp
Functionson Array:compact()
Example
<?php
$firstname = "Peter";
$lastname = "Griffin";
$age = "41";
$result = compact("firstname",
"lastname", "age");
print_r($result);
?>
Out Put
Array
(
[firstname] => Peter
[lastname] => Griffin
[age] => 41
)
Functionson Array:sort()
Example
<?php
$numbers = array(4, 6, 2, 22, 11);
sort($numbers);
print_r ($numbers);
//sort in ascending order
//sort in ascending order
rsort($numbers);
print_r ($numbers);
?>
Outline
Introduction to PHP,
Features,
sample code,
PHP script working,
PHP syntax,
conditions & Loops,
Functions,
String manipulation,
Arrays & Functions,
Form handling,
Cookies & Sessions,
using MySQL with PHP,
FORM HANDING IN PHP
What is Form?
When you login into a website or into your mail box, you are interacting with a
form.
Forms are used to get input from the user and submit it to the web server for
processing.
The diagram below illustrates the form handling process.
FORM HANDING IN PHP
When and why we are using forms?
Forms come in handy when developing flexible and dynamic applications that
accept user input.
Forms can be used to edit already existing data from the database
Create a form
We will use HTML tags to create a form. Below is the minimal list of things
you need to create a form.
Opening and closing form tags <form>…</form>
Form submission type POST or GET
Submission URL that will process the submitted data
Input fields such as input boxes, text areas, buttons,checkboxes etc.
FORM HANDING IN PHP
PHP POST method
This is the built in PHP super global array variable that is used to get values
submitted via HTTP POST method.
The array variable can be accessed from any script in the program; it has a
global scope.
This method is ideal when you do not want to display the form post values in
the URL.
A good example of using post method is when submitting login details to the
server.
It has the following syntax.
<?php
$_POST['variable_name'];
?>
HERE,
“$_POST[…]” is the PHP array
“'variable_name'” is the URL variable
name.
FORM HANDING IN PHP
PHP GET method
This is the built in PHP super global array variable that is used to get values
submitted via HTTP GET method.
The array variable can be accessed from any script in the program; it has a
global scope.
This method displays the form values in the URL.
It’s ideal for search engine forms as it allows the users to book mark the
results.
It has the following syntax.
<?php
$_GET['variable_name'];
?>
HERE,
“$_GET[…]” is the PHP array
“'variable_name'” is the URL variable
name.
POST VS GET IN PHP
POST GET
Values not visible in the URL Values visible in the URL
Has not limitation of the length of the values since
they are submitted via the body of HTTP
Has limitation on the length of the values usually
255 characters. This is because the values are
displayed in the URL. Note the upper limit of the
characters is dependent on the browser.
Has lower performance compared to Php_GET
method due to time spent encapsulation the
Php_POST values in the HTTP body
Has high performance compared to POST method
dues to the simple nature of appending the values
in the URL.
Supports many different data types such as string,
numeric, binary etc.
Supports only string data types because the values
are displayed in the URL
Results cannot be book marked Results can be book marked due to the visibility of
the values in the URL
POST VS GET IN PHP
FormHandling-using Post Method
a.html
<html>
<body>
<form action="welcome.php"
method="post">
Name:
<input type="text" name="name">
<br>
<input type="submit">
</form>
</body>
</html>
Welcome.php
<html>
<body>
Welcome
<?php
echo $_POST["name"];
?>
</body>
</html>
Form Handling-using Get Method
a.html
<html>
<body>
<form action="welcome.php"
method=“get">
Name:
<input type="text" name="name">
<br>
<input type="submit">
</form>
</body>
</html>
Welcome.php
<html>
<body>
Welcome
<?php
echo $_GET["name"];
?>
</body>
</html>
FormHandling-
Differencebetweengetand postmethod
• $_GET is an array of variables passed to the current script via the
URL parameters.
• $_POST is an array of variables passed to the current script via the
HTTP POST method.
• When to use GET?
• Information sent from a form with the GET method is visible to
everyone. GET also has limits on the amount of information to send.
The limitation is about 2000 characters.
• When to use POST?
• Information sent from a form with the POST method is invisible to
others and has no limits on the amount of information to send.
• However, because the variables are not displayed in the URL, it is
not possible to bookmark the page.
Outline
Introduction to PHP,
Features,
sample code,
PHP script working,
PHP syntax,
conditions & Loops,
Functions,
String manipulation,
Arrays & Functions,
Form handling,
Cookies & Sessions,
using MySQL with PHP,
Cookie
• What is a Cookie?
• A cookie is often used to identify a user.A cookie is a small file that the
server embeds on the user's computer. Each time the same computer requests
a page with a browser, it will send the cookie too. With PHP, you can both
create and retrieve cookie values.
• Create Cookies With PHP- is created with the setcookie() function.
• Syntax
• setcookie(name, value, expire, path, domain, secure, httponly);
• Only the name parameter is required. All other parameters are
optional.
Cookie-Create/Retrieve aCookie
<?php
setcookie(“name”, “Amit”, time() + (86400 * 30), "/"); // 86400 = 1 day
?>
<html>
<body>
<?php
if(isset($_COOKIE[“name”]))
{
$nm=$_COOKIE[“name”];
echo “Hello”,$nm;
}
else { echo “Coocke is not set”; }
?>
</body>
</html>
Cookie-Modifying aCookie
• Tomodify a cookie, just set (again) the cookie using the
setcookie() function:
Cookie- DeletingCookies
<?php
// set the expiration date to one hour ago
setcookie("user", "", time() - 3600);
?>
<html>
<body>
<?php
echo "Cookie 'user' is deleted.";
?>
</body>
</html>
Sessions
• A session is a way to store information (in variables) to be used
across multiple pages.
• Unlike a cookie, the information is not stored on the users computer.
• What is a PHP Session?
• When you work with an application, you open it, do some changes, and then
you close it. This is much like a Session. The computer knows who you are.
It knows when you start the application and when you end. But on the
internet there is one problem: the web server does not know who you are or
what you do, because the HTTP address doesn't maintain state.
• Session variables solve this problem by storing user information to be used
across multiple pages (e.g. username, favorite color, etc). By default, session
variables last until the user closes the browser.
• So; Session variables hold information about one single user, and are available
to all pages in one application.
Sessions- Start aSession
• A session is started with the session_start() function.
• Session variables are set with the PHP global variable: $_SESSION.
• Example - demo_session1.php
<?php
session_start(); // Start the session ?>
<html>
<body>
<?php
$_SESSION["favcolor"] = "green"; // Set session variable
echo "Session variables are set."; ?>
</body>
</html>
Sessions: GetSession VariableValues
• Next, we create another page called "demo_session2.php". From this
page, we will access the session information we set on the first page
("demo_session1.php").
• session variable values are stored in the global $_SESSION variable
• Example- demo_session2.php
<?php
session_start(); ?>
<html>
<body>
<?php
// Echo session variables that were set on previous page
echo "Favorite color is " . $_SESSION["favcolor"];
?>
</body>
</html>
Sessions- Modify aSession
• Tochange a session variable, just overwrite it:
<?php
session_start(); ?>
<html>
<body>
<?php
// to change a session variable, just overwrite it
$_SESSION["favcolor"] = "yellow";
print_r($_SESSION);
?>
</body>
</html>
Sessions: Destroy aSession
• Toremove all global session variables and destroy the session, use
session_unset() and session_destroy():
• Example-
<?php
session_start(); ?>
<html>
<body>
// remove all session variables
// destroy the session
<?php
session_unset();
session_destroy();
?>
</body>
</html>
Outline
Introduction to PHP,
Features,
sample code,
PHP script working,
PHP syntax,
conditions & Loops,
Functions,
String manipulation,
Arrays & Functions,
Form handling,
Cookies & Sessions,
Using MySQL with PHP,
Open a Connection toMySQL
<?php
// Create connection
$conn = new mysqli(“localhost”, “root”, “”);
//MySQLi extension (the "i" stands for improved)
// Check connection
if(!$conn){
die('Could not connect: '.mysqli_connect_error());
}
echo 'Connected successfully<br/>';
?>
Select Data Froma MySQL Database
<?php
$conn = mysqli_connect(‘localhost’, ‘root’, ‘root’, ‘db1’);
if(!$conn){
die(mysqli_connect_error());
}
echo 'Connected successfully<br>';
$sql = 'SELECT * FROM STUD';
$rs=mysqli_query($conn, $sql);
$nrows= mysqli_num_rows($rs);
Select Data Froma MySQL Database
if($nrows > 0){
while($row = mysqli_fetch_assoc($rs)){
echo "ID :{$row['id']} <br>";
echo
echo
echo
"FNAME : {$row['firstname']} <br>";
"LNAME : {$row['lastname']} <br>";
"--------------------------------<br>";
}
}
else { echo “ No result"; }
mysqli_close($conn);
?>
Outline
PHP
WAP & WML,
AJAX
WAP & WML
WAP-Introduction
WAP stands for Wireless Application Protocol
WAP is an application communication protocol
WAP is used to access services and information
WAP is for handheld devices such as mobile phones
WAP is a protocol designed for micro browsers
WAP enables the creating of web applications for mobile devices.
WAP uses the mark-up language WML
WAP-Introduction
The basic aim of WAP is to provide a
web-like experience on small portable
devices - like mobile phones and PDAs
WAP-Introduction
• Purpose of WAP
To enable easy, fast delivery of relevant information and
services to mobile users.
• Type of devices that use WAP
Handheld digital wireless devices such as mobile phones,
pagers, two-way radios, smart phones and communicators --
from low-end to high-end.
• Type of OS that use WAP
It can be built on any operating system including Palm OS,
EPOC 32, Windows CE, FLEXOS, OS/9, Java O
Components of WAPArchitecture
Other Services
And Applications
Application Layer (WAE)
GSM CDMA PHS IS-136 CDPD PDC-P FLEX Etc…
Session Layer (WSP)
Transaction Layer (WTP)
Security Layer (WTLS)
Transport Layer (WDP)
Bearers :
Wireless Application Environment(WAE)-
components
Addressing
model –uses
URL & URI
WML- similar
feature like
HTML
WML script –
For user I/P
validation
WTA(Wireless
Telephony
Application)
WirelessMarkupLanguage (WML)
• WML is the markup language defined in the WAP specification. WAP
sites are written in WML, while web sites are written in HTML.
WML is very similar to HTML. Both of them use tags and are
written in plain text format.
• WML (Wireless Markup Language), formerly called HDML
(Handheld Devices Markup Languages), is a language that allows
the text portions of Web pages to be presented on cellular telephones
and personal digital assistants (PDAs) via wireless access.
Wireless Markup Language
• A WML document is made up of multiple cards.
• Cards can be grouped together into a deck.
WML follows a deck and card.
• A user navigates with the WML browser through a
series of WML cards.
A WML deck is similar to an HTML page.
WMLElements
text
hyperlink (anchor)
action
goto wml page
trigger event (units = tenths of a second)
input user text
return to previous page
value of variable
display image
set variable
<p> </p>
<a href=...> </a>
<do> </do>
<go href=.../>
<timer>
<input/>
<prev/>
$(…)
<img src=… />
<postfield name=… value=…/>
<select > <option> <option> </select> select box
WMLStructure
< ? xml version=“1.0” ? >
<!DOCTYPE wml …>
<wml>
<card>
<p>
Text….
</p>
<p>
Text……
</p>
</card>
<card>
...
</card>
</wml>
WMLExample
<?xml version="1.0"?>
<wml>
<card id="one" title="First Card">
<p>
This is the first card in the deck
</p>
</card>
<card id="two" title="Second Card">
<p>
Ths is the second card in the deck
</p>
</card>
</wml>
WMLScripts
• WMLScript (Wireless Markup Language Script) is the client-
side scripting language of WML (Wireless Markup Language).
• A scripting language is similar to a programming language,
but is of lighter weight.
• With WMLScript, the wireless device can do some of the
processing and computation.
• This reduces the number of requests and responses to/from
the server.
WAPApplications
• Banking:
• Finance:
• Shopping:
• Ticketing:
• Entertainment:
• Weather:
• E- Messaging:
Outline
PHP
WAP & WML,
AJAX
AJAX
AJAX
• What is AJAX?
• AJAX = Asynchronous JavaScript And XML.
• AJAX is not a programming language.
• AJAX just uses a combination of:
• A browser built-in XMLHttpRequest object (to request data from a
web server)
• JavaScript and HTML DOM (to display or use the data)
AJAX -Technologies
• AJAX cannot work independently. It is used in combination
with other technologies to create interactive webpages.
• JavaScript
• Loosely typed scripting language.
• JavaScript function is called when an event occurs in a page.
• Glue for the whole AJAX operation.
• DOM
• API for accessing and manipulating structured documents.
• Represents the structure of XML and HTML documents.
• CSS
• Allows for a clear separation of the presentation style from the
content and may be changed programmatically by JavaScript
• XMLHttpRequest
• JavaScript object that performs asynchronous interaction with the server.
AJAX – Real TimeExamples
• Here is a list of some famous web applications that make use
of AJAX.
1. Google Maps
• A user can drag an entire map by using the mouse, rather than clicking on
a button.
2. Google Suggest
• As you type, Google offers suggestions. Use the arrow keys to navigate
the results.
3. Gmail
• Gmail is a webmail built on the idea that emails can be more
intuitive, efficient, and useful.
4. Yahoo Maps (new)
• Now it's even easier and more fun to get where you're going!
How AJAX Works
AJAX ProcessingSteps
• Steps of AJAX Operation
• A client event occurs.
• An XMLHttpRequest object is created.
• The XMLHttpRequest object is configured.
• The XMLHttpRequest object makes an asynchronous request to
the Webserver.
• The Webserver returns the result containing XML document.
• The XMLHttpRequest object calls the callback() function and processes
the result.
• The HTML DOM is updated.
AJAXExample –table.html
<html>
<head>
<script>
var request;
function sendInfo() {
var
v=document.f1.t1.value;
var
url="index.jsp?val="+v;
if(window.XMLHttpRequest){
request=new
XMLHttpRequest();
}
function getInfo(){
if (request.readyState==4) {
var val=request.responseText;
document.getElementById('amit').innerHTM
L=val;
}
}
</script>
</head>
of ajax</h1>
<body>
<h1>This is an example
<form name=“f1">
<input type="text" name="t1">
<input type="button" value="ShowTable"
onClick="sendInfo()">
</form>
<span id="amit"> </span>
</body>
</html>
AJAX Example-index.jsp
<%
int n=Integer.parseInt(request.getParameter("val"));
for(int i=1;i<=10;i++)
out.print(i*n+"<br>");
%>
AXAX Exampleoutput
References
• https://www.w3schools.com/php/php_intro.asp
• https://www.w3schools.com/php/php_looping.asp
• https://www.w3schools.com/php/php_if_else.asp
• https://www.w3schools.com/php/php_string.asp
• https://www.w3schools.com/php/php_arrays.asp
• https://www.w3schools.com/php/php_arrays_multi.asp
• https://www.w3schools.com/php/php_forms.asp
• https://www.w3schools.com/php/func_array_extract.asp
• https://www.w3schools.com/php/func_array_compact.asp
• https://www.w3schools.com/php/func_array_in_array.asp
• https://www.w3schools.com/php/php_cookies.asp
• https://www.w3schools.com/php/php_sessions.asp
• https://www.tutorialspoint.com/wap/wap_wml_script.htm
• https://www.w3schools.com/xml/ajax_intro.asp
• https://www.tutorialspoint.com/ajax/ajax_examples.htm
Thank You
98
gharu.anand@gmail.com
Blog : anandgharu.wordpress.com
Prof. Gharu Anand N. 98

More Related Content

What's hot

Javascript
JavascriptJavascript
Javascript
Priyanka Pradhan
 
jQuery from the very beginning
jQuery from the very beginningjQuery from the very beginning
jQuery from the very beginning
Anis Ahmad
 
Internet and Web Technology (CLASS-14) [JSP] | NIC/NIELIT Web Technology
Internet and Web Technology (CLASS-14) [JSP] | NIC/NIELIT Web Technology Internet and Web Technology (CLASS-14) [JSP] | NIC/NIELIT Web Technology
Internet and Web Technology (CLASS-14) [JSP] | NIC/NIELIT Web Technology
Ayes Chinmay
 
Java script final presentation
Java script final presentationJava script final presentation
Java script final presentationAdhoura Academy
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScript
Marlon Jamera
 
The Django Web Application Framework 2
The Django Web Application Framework 2The Django Web Application Framework 2
The Django Web Application Framework 2
fishwarter
 
JSMVCOMFG - To sternly look at JavaScript MVC and Templating Frameworks
JSMVCOMFG - To sternly look at JavaScript MVC and Templating FrameworksJSMVCOMFG - To sternly look at JavaScript MVC and Templating Frameworks
JSMVCOMFG - To sternly look at JavaScript MVC and Templating FrameworksMario Heiderich
 
WEB TECHNOLOGIES JavaScript
WEB TECHNOLOGIES JavaScriptWEB TECHNOLOGIES JavaScript
JavaScript and jQuery Fundamentals
JavaScript and jQuery FundamentalsJavaScript and jQuery Fundamentals
JavaScript and jQuery FundamentalsBG Java EE Course
 
1. java script language fundamentals
1. java script language fundamentals1. java script language fundamentals
1. java script language fundamentals
Rajiv Gupta
 
10 jsp-scripting-elements
10 jsp-scripting-elements10 jsp-scripting-elements
10 jsp-scripting-elements
Phạm Thu Thủy
 
Java script
Java scriptJava script
Java script
Rajkiran Mummadi
 
Why Django for Web Development
Why Django for Web DevelopmentWhy Django for Web Development
Why Django for Web Development
Morteza Zohoori Shoar
 
An Introduction to JavaScript
An Introduction to JavaScriptAn Introduction to JavaScript
An Introduction to JavaScripttonyh1
 
JavaScript 101
JavaScript 101JavaScript 101
JavaScript 101
ygv2000
 

What's hot (19)

Javascript
JavascriptJavascript
Javascript
 
jQuery from the very beginning
jQuery from the very beginningjQuery from the very beginning
jQuery from the very beginning
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScript
 
Internet and Web Technology (CLASS-14) [JSP] | NIC/NIELIT Web Technology
Internet and Web Technology (CLASS-14) [JSP] | NIC/NIELIT Web Technology Internet and Web Technology (CLASS-14) [JSP] | NIC/NIELIT Web Technology
Internet and Web Technology (CLASS-14) [JSP] | NIC/NIELIT Web Technology
 
Java script final presentation
Java script final presentationJava script final presentation
Java script final presentation
 
JavaScripts & jQuery
JavaScripts & jQueryJavaScripts & jQuery
JavaScripts & jQuery
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScript
 
The Django Web Application Framework 2
The Django Web Application Framework 2The Django Web Application Framework 2
The Django Web Application Framework 2
 
JSMVCOMFG - To sternly look at JavaScript MVC and Templating Frameworks
JSMVCOMFG - To sternly look at JavaScript MVC and Templating FrameworksJSMVCOMFG - To sternly look at JavaScript MVC and Templating Frameworks
JSMVCOMFG - To sternly look at JavaScript MVC and Templating Frameworks
 
WEB TECHNOLOGIES JavaScript
WEB TECHNOLOGIES JavaScriptWEB TECHNOLOGIES JavaScript
WEB TECHNOLOGIES JavaScript
 
JavaScript and jQuery Fundamentals
JavaScript and jQuery FundamentalsJavaScript and jQuery Fundamentals
JavaScript and jQuery Fundamentals
 
Javascript tutorial
Javascript tutorialJavascript tutorial
Javascript tutorial
 
Javascript by geetanjali
Javascript by geetanjaliJavascript by geetanjali
Javascript by geetanjali
 
1. java script language fundamentals
1. java script language fundamentals1. java script language fundamentals
1. java script language fundamentals
 
10 jsp-scripting-elements
10 jsp-scripting-elements10 jsp-scripting-elements
10 jsp-scripting-elements
 
Java script
Java scriptJava script
Java script
 
Why Django for Web Development
Why Django for Web DevelopmentWhy Django for Web Development
Why Django for Web Development
 
An Introduction to JavaScript
An Introduction to JavaScriptAn Introduction to JavaScript
An Introduction to JavaScript
 
JavaScript 101
JavaScript 101JavaScript 101
JavaScript 101
 

Similar to Wt unit 4 server side technology-2

Php
PhpPhp
Prersentation
PrersentationPrersentation
Prersentation
Ashwin Deora
 
Intro to php
Intro to phpIntro to php
Intro to php
Ahmed Farag
 
PHP from soup to nuts Course Deck
PHP from soup to nuts Course DeckPHP from soup to nuts Course Deck
PHP from soup to nuts Course Deck
rICh morrow
 
PHP - Introduction to PHP Fundamentals
PHP -  Introduction to PHP FundamentalsPHP -  Introduction to PHP Fundamentals
PHP - Introduction to PHP Fundamentals
Vibrant Technologies & Computers
 
basic concept of php(Gunikhan sonowal)
basic concept of php(Gunikhan sonowal)basic concept of php(Gunikhan sonowal)
basic concept of php(Gunikhan sonowal)
Guni Sonow
 
Php basic for vit university
Php basic for vit universityPhp basic for vit university
Php basic for vit university
Mandakini Kumari
 
Php Tutorial
Php TutorialPhp Tutorial
Php Tutorial
SHARANBAJWA
 
Introduction to PHP - Basics of PHP
Introduction to PHP - Basics of PHPIntroduction to PHP - Basics of PHP
Introduction to PHP - Basics of PHP
wahidullah mudaser
 
Lecture2_IntroductionToPHP_Spring2023.pdf
Lecture2_IntroductionToPHP_Spring2023.pdfLecture2_IntroductionToPHP_Spring2023.pdf
Lecture2_IntroductionToPHP_Spring2023.pdf
ShaimaaMohamedGalal
 
WT_PHP_PART1.pdf
WT_PHP_PART1.pdfWT_PHP_PART1.pdf
WT_PHP_PART1.pdf
HambardeAtharva
 
Php with mysql ppt
Php with mysql pptPhp with mysql ppt
Php with mysql ppt
Rajamanickam Gomathijayam
 
Php.ppt
Php.pptPhp.ppt
Php.ppt
Nidhi mishra
 
Php
PhpPhp
Basics PHP
Basics PHPBasics PHP
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
Taha Malampatti
 
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)Muhamad Al Imran
 
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)Muhamad Al Imran
 

Similar to Wt unit 4 server side technology-2 (20)

Php
PhpPhp
Php
 
Prersentation
PrersentationPrersentation
Prersentation
 
Intro to php
Intro to phpIntro to php
Intro to php
 
PHP from soup to nuts Course Deck
PHP from soup to nuts Course DeckPHP from soup to nuts Course Deck
PHP from soup to nuts Course Deck
 
PHP - Introduction to PHP Fundamentals
PHP -  Introduction to PHP FundamentalsPHP -  Introduction to PHP Fundamentals
PHP - Introduction to PHP Fundamentals
 
basic concept of php(Gunikhan sonowal)
basic concept of php(Gunikhan sonowal)basic concept of php(Gunikhan sonowal)
basic concept of php(Gunikhan sonowal)
 
Php basic for vit university
Php basic for vit universityPhp basic for vit university
Php basic for vit university
 
Php Tutorial
Php TutorialPhp Tutorial
Php Tutorial
 
Phphacku iitd
Phphacku iitdPhphacku iitd
Phphacku iitd
 
Introduction to PHP - Basics of PHP
Introduction to PHP - Basics of PHPIntroduction to PHP - Basics of PHP
Introduction to PHP - Basics of PHP
 
Lecture2_IntroductionToPHP_Spring2023.pdf
Lecture2_IntroductionToPHP_Spring2023.pdfLecture2_IntroductionToPHP_Spring2023.pdf
Lecture2_IntroductionToPHP_Spring2023.pdf
 
WT_PHP_PART1.pdf
WT_PHP_PART1.pdfWT_PHP_PART1.pdf
WT_PHP_PART1.pdf
 
Php with mysql ppt
Php with mysql pptPhp with mysql ppt
Php with mysql ppt
 
Php.ppt
Php.pptPhp.ppt
Php.ppt
 
Php
PhpPhp
Php
 
Basics PHP
Basics PHPBasics PHP
Basics PHP
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
 
Php i basic chapter 3
Php i basic chapter 3Php i basic chapter 3
Php i basic chapter 3
 
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
 
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
 

More from PUNE VIDYARTHI GRIHA'S COLLEGE OF ENGINEERING, NASHIK

BASICS OF COMPUTER
BASICS OF COMPUTERBASICS OF COMPUTER
Unit 6 dsa SEARCHING AND SORTING
Unit 6 dsa SEARCHING AND SORTINGUnit 6 dsa SEARCHING AND SORTING
Unit 5 dsa QUEUE
Unit 5 dsa QUEUEUnit 5 dsa QUEUE
Unit 3 dsa LINKED LIST
Unit 3 dsa LINKED LISTUnit 3 dsa LINKED LIST
Unit 2 dsa LINEAR DATA STRUCTURE
Unit 2 dsa LINEAR DATA STRUCTUREUnit 2 dsa LINEAR DATA STRUCTURE
Unit 1 dsa
Unit 1 dsaUnit 1 dsa
Wt unit 1 ppts web development process
Wt unit 1 ppts web development processWt unit 1 ppts web development process
Wt unit 1 ppts web development process
PUNE VIDYARTHI GRIHA'S COLLEGE OF ENGINEERING, NASHIK
 
Wt unit 3 server side technology
Wt unit 3 server side technologyWt unit 3 server side technology
OPERATING SYSTEM
OPERATING SYSTEMOPERATING SYSTEM
PL-3 LAB MANUAL
PL-3 LAB MANUALPL-3 LAB MANUAL
COMPUTER LABORATORY-4 LAB MANUAL BE COMPUTER ENGINEERING
COMPUTER LABORATORY-4 LAB MANUAL BE COMPUTER ENGINEERINGCOMPUTER LABORATORY-4 LAB MANUAL BE COMPUTER ENGINEERING
COMPUTER LABORATORY-4 LAB MANUAL BE COMPUTER ENGINEERING
PUNE VIDYARTHI GRIHA'S COLLEGE OF ENGINEERING, NASHIK
 
Deld model answer nov 2017
Deld model answer nov 2017Deld model answer nov 2017
DEL LAB MANUAL
DEL LAB MANUALDEL LAB MANUAL

More from PUNE VIDYARTHI GRIHA'S COLLEGE OF ENGINEERING, NASHIK (20)

BASICS OF COMPUTER
BASICS OF COMPUTERBASICS OF COMPUTER
BASICS OF COMPUTER
 
Wt unit 3 server side technology
Wt unit 3 server side technologyWt unit 3 server side technology
Wt unit 3 server side technology
 
Wt unit 2 ppts client sied technology
Wt unit 2 ppts client sied technologyWt unit 2 ppts client sied technology
Wt unit 2 ppts client sied technology
 
web development process WT
web development process WTweb development process WT
web development process WT
 
Unit 6 dsa SEARCHING AND SORTING
Unit 6 dsa SEARCHING AND SORTINGUnit 6 dsa SEARCHING AND SORTING
Unit 6 dsa SEARCHING AND SORTING
 
Unit 5 dsa QUEUE
Unit 5 dsa QUEUEUnit 5 dsa QUEUE
Unit 5 dsa QUEUE
 
Unit 3 dsa LINKED LIST
Unit 3 dsa LINKED LISTUnit 3 dsa LINKED LIST
Unit 3 dsa LINKED LIST
 
Unit 2 dsa LINEAR DATA STRUCTURE
Unit 2 dsa LINEAR DATA STRUCTUREUnit 2 dsa LINEAR DATA STRUCTURE
Unit 2 dsa LINEAR DATA STRUCTURE
 
Unit 1 dsa
Unit 1 dsaUnit 1 dsa
Unit 1 dsa
 
Wt unit 1 ppts web development process
Wt unit 1 ppts web development processWt unit 1 ppts web development process
Wt unit 1 ppts web development process
 
Wt unit 3 server side technology
Wt unit 3 server side technologyWt unit 3 server side technology
Wt unit 3 server side technology
 
LANGUAGE TRANSLATOR
LANGUAGE TRANSLATORLANGUAGE TRANSLATOR
LANGUAGE TRANSLATOR
 
OPERATING SYSTEM
OPERATING SYSTEMOPERATING SYSTEM
OPERATING SYSTEM
 
LEX & YACC TOOL
LEX & YACC TOOLLEX & YACC TOOL
LEX & YACC TOOL
 
PL-3 LAB MANUAL
PL-3 LAB MANUALPL-3 LAB MANUAL
PL-3 LAB MANUAL
 
COMPUTER LABORATORY-4 LAB MANUAL BE COMPUTER ENGINEERING
COMPUTER LABORATORY-4 LAB MANUAL BE COMPUTER ENGINEERINGCOMPUTER LABORATORY-4 LAB MANUAL BE COMPUTER ENGINEERING
COMPUTER LABORATORY-4 LAB MANUAL BE COMPUTER ENGINEERING
 
Deld model answer nov 2017
Deld model answer nov 2017Deld model answer nov 2017
Deld model answer nov 2017
 
DEL LAB MANUAL
DEL LAB MANUALDEL LAB MANUAL
DEL LAB MANUAL
 
LOGIC FAMILY
LOGIC FAMILYLOGIC FAMILY
LOGIC FAMILY
 
MICROCONTROLLER 8051
MICROCONTROLLER 8051MICROCONTROLLER 8051
MICROCONTROLLER 8051
 

Recently uploaded

Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Teleport Manpower Consultant
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
Jayaprasanna4
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
Robbie Edward Sayers
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
AJAYKUMARPUND1
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
gerogepatton
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
AhmedHussein950959
 
addressing modes in computer architecture
addressing modes  in computer architectureaddressing modes  in computer architecture
addressing modes in computer architecture
ShahidSultan24
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
Intella Parts
 
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdfCOLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
Kamal Acharya
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
Kamal Acharya
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
Pratik Pawar
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
Divya Somashekar
 
Democratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek AryaDemocratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek Arya
abh.arya
 
Vaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdfVaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdf
Kamal Acharya
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
AafreenAbuthahir2
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
Pipe Restoration Solutions
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
JoytuBarua2
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 

Recently uploaded (20)

Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
 
addressing modes in computer architecture
addressing modes  in computer architectureaddressing modes  in computer architecture
addressing modes in computer architecture
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
 
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdfCOLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
 
Democratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek AryaDemocratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek Arya
 
Vaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdfVaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdf
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 

Wt unit 4 server side technology-2

  • 1. Pune Vidyarthi Griha’s COLLEGE OF ENGINEERING, NASHIK “SERVER SIDE TECHNOLOGYIES - II” By Prof. Anand N. Gharu (Assistant Professor) PVGCOE Computer Dept. 16 Feb 2020Note: Thematerial to preparethis presentation hasbeentaken from internet andare generatedonly for students referenceandnot for commercialuse.
  • 3. PHP
  • 4. Outline Introduction to PHP, Features, sample code, PHP script working, PHP syntax, conditions & Loops, Functions, String manipulation, Arrays & Functions, Form handling, Cookies & Sessions, using MySQL with PHP,
  • 5. Introduction toPHP • PHP is an acronym for "PHP: Hypertext Preprocessor" • PHP is a widely-used, open source scripting language • PHP scripts are executed on the server • PHP is free to download and use • What is a PHP File? • PHP files can contain text, HTML, CSS, JavaScript, and PHP code • PHP code are executed on the server, and the result is returned to the browser as plain HTML • PHP files have extension ".php"
  • 6. • What Can PHP Do? • PHP can generate dynamic page content • PHP can create, open, read, write, delete, and close files on the server • PHP can collect form data • PHP can send and receive cookies • PHP can add, delete, modify data in your database • PHP can be used to control user-access • PHP can encrypt data • With PHP you are not limited to output HTML. You can output images, PDF files, and even Flash movies. You can also output any text, such as XHTML and XML. Introduction toPHP
  • 7. Features /Advantages of PHP • PHP runs on various platforms (Windows, Linux, Unix, Mac OS X, etc.) • PHP is compatible with almost all servers used today (Apache, IIS, etc.) • PHP supports a wide range of databases • PHP is free. Download it from the official PHP resource: www.php.net • PHP is easy to learn and runs efficiently on the server side. • Advantages : • Simple , Interpreted , Faster , Open Source , Platform Independent , Efficiency, Flexibility.
  • 8. PHP Syntax • Basic PHP Syntax • A PHP script can be placed anywhere in the document. • A PHP script starts with <?php and ends with ?>: • <?php // PHP code goes here ?> • The default file extension for PHP files is ".php".
  • 9. sample code– Example1toprintHelloWorldusingPHP • <!DOCTYPE html> <html> <body> <h1>My first PHP page</h1> <?php echo "Hello World!"; ?> </body> </html>
  • 10. sample code– <?php $txt = "Hello world!"; $x = 5; $y = 10.5; echo $txt; echo "<br>"; echo $x; echo "<br>"; echo $y; ?> </body> </html> "Hello world!" 5 10.5 Example2 variable declaration <html> <body> Out Put
  • 11. PHPVariables • Rules for PHP variables: • A variable starts with the $ sign, followed by the name of the variable • A variable name must start with a letter or the underscore character • A variable name cannot start with a number • A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ ) • Variable names are case-sensitive ($age and $AGE are two different variables)
  • 12. sample code– Example3-Tooutputtextandavariable • <html> <body> <?php $txt = "W3Schools.com"; echo "I love $txt"; ?> </body> </html> • <html> <body> <?php $txt = "W3Schools.com"; echo "I love " . $txt . ; ?> </body> </html>
  • 13. Program for addition oftwo numbers • <body> • <?php • $n1=5; • $n2=6; • $sum=$n1+$n2; • Echo “Summation is”.$sum; • ?> • </body>
  • 14. PHP Variables Scope • In PHP, variables can be declared anywhere in the script. • The scope of a variable is the part of the script where the variable can be referenced/used. • PHP has three different variable scopes: • local • global • static
  • 15. PHP VariablesScope- Global and LocalScope Example <?php $x = 5; // global scope function myTest() { echo "Variable x inside function is: $x"; } myTest(); echo "Variable x outside function is: $x”; ?> Out put • Variable x inside function is: • Variable x outside function is: 5 A variable declared outside a function has a GLOBAL SCOPE and can only be accessed outside a function:
  • 16. PHP VariablesScope- Global and LocalScope Example <?php function myTest() { $x = 5; // local scope echo "Variable x inside function is: $x"; } myTest(); echo "Variable x outside function is: $x"; ?> Out put • Variable x inside function is: 5 • Variable x outside function is: A variable declared within a function has a LOCAL SCOPE and can only be accessed within that function:
  • 17. PHP VariablesScope- The globalKeyword Example <?php $x = 5; $y = 10; function myTest() { global $x, $y; $y = $x + $y; } myTest(); // run function echo $y; // output the new value for variable $y ?> Out put 15 The global keyword is used to access a global variable from within a function
  • 18. PHP ComparisonOperators Operator Name Example Result == Equal $x == $y Returns true if $x is equal to $y === Identical $x === $y Returns true if $x is equal to $y, and they are of the same type != <> Not equal $x != $y Returns true if $x is not equal to $y > Greater than $x > $y Returns true if $x is greater than $y < Less than $x < $y Returns true if $x is less than $y >= Greater than or equal to $x >= $y Returns true if $x is greater than or equal to $y <= Less than or equal to $x <= $y Returns true if $x is less than or equal to $y
  • 19. Outline Introduction to PHP, Features, sample code, PHP script working, PHP syntax, conditions & Loops, Functions, String manipulation, Arrays & Functions, Form handling, Cookies & Sessions, using MySQL with PHP,
  • 20. Conditions andLoops • If else • Elseif ladder • Switch case Conditional Statements • While • Do while • For • Foreach Loop Statements
  • 21. If…else Syntax • If(condition) • statements; • else • statements; Example • <body> • <?php • $n=5; • If($n%2 == 0) • Echo “Number is Even”; • Else • Echo “Number is Odd”; • ?> • <body>
  • 22. Elseif Syntax • If(condition) • statements; • Elseif(condition) • statements; • Else • statements; Example • <body> • <?php • $day=date(“l”); • If($day == “Saturday”)) • Echo “Happy Weekend”; • Elseif($day == “Sunday”)) • Echo “Happy Sunday”; • Else • Echo “Nice Working day”; • ?> • <body>
  • 23. Switchcase Syntax • Switch(expression) • { • Case constant_expression: • statements; • break; • Default: • statements; • } Example • • <?php $favcolor = "red"; switch ($favcolor) { case "red": echo "Your favorite color is red!"; break; • case "blue": echo "Your favorite color is blue!"; break; default: echo "Your favorite color is neither red, blue!"; } ?>
  • 24. WhileLoop Syntax • while (condition is true) { • code to be executed; • } Example • <?php $x = 1; while($x <= 5) { echo "The number is: $x <br>"; $x++; } ?>
  • 25. Do-WhileLoop Syntax • do { code to be executed; } while (condition is true); Example • <?php $x = 1; do { echo "The number is: $x <br>"; $x++; } while ($x <= 5); ?>
  • 26. ForLoop Syntax • for (init counter; test counter; increment counter) • { code to be executed; } { Example • <?php for ($x = 0; $x <= 10; $x++) echo "The number is: $x <br>"; } ?>
  • 27. ForeachLoop Syntax • foreach ($array as $value) { code to be executed; } { Example • <?php $colors = array("red", "green", "blue"); foreach ($colors as $value) echo "$value <br>"; } ?>
  • 28. Outline Introduction to PHP, Features, sample code, PHP script working, PHP syntax, conditions & Loops, Functions, String manipulation, Arrays & Functions, Form handling, Cookies & Sessions, using MySQL with PHP,
  • 29. User DefinedFunctions • function functionName() { code to be executed; } Syntax Example • <body> <?php function writeMsg() { echo "Hello world!"; } writeMsg(); ?> </body>
  • 30. ParameterizedFunctions • <html> • <body> • <?php function Add($a,$b) { $sum=$a+$b; echo “Sum is $sum"; } Add(10,20); ?> • </body> • </html> Example Output • Sum is 30
  • 31. Returningvalue throughfunction • <html> • <body> • <?php function Add($a,$b) { $sum=$a+$b; return $sum; } $Result=Add(10,20); echo “Sum is $Result"; ?> • </body> • </html> Example Output • Sum is 30
  • 32. Setting default valuesfor function parameter Example <html> <body> <?php function Add($a,$b=300) { $sum=$a+$b; echo “Sum is $sum"; } Add(10); Add(10,20); ?> </body> </html> Output • Sum is 310 • Sum is 30
  • 33. Dynamic FunctionCalls Example <<html> <body> <?php function Hello() { echo "Hello How R U?"; } $fh = "Hello"; $fh(); ?> </body> </html> Output Hello How R U?
  • 34. Outline Introduction to PHP, Features, sample code, PHP script working, PHP syntax, conditions & Loops, Functions, String manipulation, Arrays & Functions, Form handling, Cookies & Sessions, using MySQL with PHP,
  • 35. StringManipulation String Manipulation Function Description Example strlen() returns the length of a string <?php echo strlen("Hello world!"); ?> // outputs 12 str_word_count() counts the number of words <?php echo str_word_count("Hello world!"); ?> // outputs 2 strrev() reverses a string <?php echo strrev("Hello world!"); ?> // outputs !dlrow olleH strpos() searches for a specific text within a string. <?php echo strpos("Hello world!", "world"); ?> // outputs 6 str_replace() replaces some characters with some other characters in a string. <?php echo str_replace(“Ram", “Holly", "Hello Ram"); ?> // outputs Hello Holly!
  • 36. Outline Introduction to PHP, Features, sample code, PHP script working, PHP syntax, conditions & Loops, Functions, String manipulation, Arrays & Functions, Form handling, Cookies & Sessions, using MySQL with PHP,
  • 37. Arrays • Create an Array in PHP • In PHP, the array() function is used to create an array: • array(); • In PHP, there are three types of arrays: 1. Indexed arrays - Arrays with a numeric index 2. Associative arrays - Arrays with named keys 3. Multidimensional arrays - Arrays containing one or more arrays
  • 38. Arrays- IndexedArrays • There are two ways to create indexed arrays: 1. The index can be assigned automatically as below : • $cars = array("Volvo", "BMW", "Toyota"); 2. The index can be assigned manually: • $cars[0] = "Volvo"; $cars[1] = "BMW"; $cars[2] = "Toyota";
  • 39. Arrays-IndexedArrays • To create and print array • Example- • <?php $cars = array("Volvo", "BMW", "Toyota"); echo "I like " . $cars[0] . ", " . $cars[1] . " and " . $cars[2] . "."; ?> • Get The Length of an Array - The count() Function • Example • <?php $cars = array("Volvo", "BMW", "Toyota"); echo count($cars); ?>
  • 40. Arrays-IndexedArrays • Loop Through an Indexed Array • Example • <?php $cars = array("Volvo", "BMW", "Toyota"); $arrlength = count($cars); for($x = 0; $x < $arrlength; $x++) { echo $cars[$x]; echo "<br>"; } ?>
  • 41. Arrays- AssociativeArrays • Associative arrays are arrays that use named keys that you assign to them. • There are two ways to create an associative array: 1. $age = array("Peter"=>"35", "Ben"=>"37", "Joe"=>"43"); 2. $age['Peter'] = "35"; $age['Ben'] = "37"; $age['Joe'] = "43";
  • 42. Arrays- AssociativeArrays • Example • <?php $age = array("Peter"=>"35", "Ben"=>"37", "Joe"=>"43"); echo "Peter is " . $age['Peter'] . " years old."; ?> • Loop Through an Associative Array • Example • <?php $age = array("Peter"=>"35", "Ben"=>"37", "Joe"=>"43"); foreach($age as $x => $x_value) { echo "Key=" . $x . "Value=" . $x_value; echo "<br>"; } ?>
  • 43. Arrays- MultidimensionalArrays • PHP understands multidimensional arrays that are two, three, four, five, or more levels deep. • PHP - Two-dimensional Arrays • A two-dimensional array is an array of arrays • First, take a look at the following table: • Example • $cars = array ( array("Volvo",22,18), array("BMW",15,13), ); Name Stock Sold Volvo 22 18 BMW 15 13
  • 44. FunctionsonArray • print_r() –Prints all elements of an array in standard format • extract()-Converts array into variables • compact()-Converts group of variables into array • is_array() –to check weather a particular elements is an array or not. • sort() - sort arrays in ascending order • rsort() - sort arrays in descending order, • asort()-sorts associative arrays in ascending order, on values • ksort()-sorts associative arrays in ascending order,on keys • arsort()- sorts associative arrays in descending order,on values • krsort()-sorts associative arrays in descending order,on keys
  • 45. Functionson Array:print_r() Example <?php $a = array ('a' => 'apple', 'b' => 'banana‘) print_r ($a); ?> Out Put Array ( [a] => apple [b] => banana )
  • 46. Functions on Array:extract() Example <?php $my_array = array(“Rno" => “1", “ Name" => “Anna", “Class" => “TE Comp"); extract($my_array); echo $Rno; echo $Name; echo $Class; ?> Out Put 1 Anna TE Comp
  • 47. Functionson Array:compact() Example <?php $firstname = "Peter"; $lastname = "Griffin"; $age = "41"; $result = compact("firstname", "lastname", "age"); print_r($result); ?> Out Put Array ( [firstname] => Peter [lastname] => Griffin [age] => 41 )
  • 48. Functionson Array:sort() Example <?php $numbers = array(4, 6, 2, 22, 11); sort($numbers); print_r ($numbers); //sort in ascending order //sort in ascending order rsort($numbers); print_r ($numbers); ?>
  • 49. Outline Introduction to PHP, Features, sample code, PHP script working, PHP syntax, conditions & Loops, Functions, String manipulation, Arrays & Functions, Form handling, Cookies & Sessions, using MySQL with PHP,
  • 50. FORM HANDING IN PHP What is Form? When you login into a website or into your mail box, you are interacting with a form. Forms are used to get input from the user and submit it to the web server for processing. The diagram below illustrates the form handling process.
  • 51. FORM HANDING IN PHP When and why we are using forms? Forms come in handy when developing flexible and dynamic applications that accept user input. Forms can be used to edit already existing data from the database Create a form We will use HTML tags to create a form. Below is the minimal list of things you need to create a form. Opening and closing form tags <form>…</form> Form submission type POST or GET Submission URL that will process the submitted data Input fields such as input boxes, text areas, buttons,checkboxes etc.
  • 52. FORM HANDING IN PHP PHP POST method This is the built in PHP super global array variable that is used to get values submitted via HTTP POST method. The array variable can be accessed from any script in the program; it has a global scope. This method is ideal when you do not want to display the form post values in the URL. A good example of using post method is when submitting login details to the server. It has the following syntax. <?php $_POST['variable_name']; ?> HERE, “$_POST[…]” is the PHP array “'variable_name'” is the URL variable name.
  • 53. FORM HANDING IN PHP PHP GET method This is the built in PHP super global array variable that is used to get values submitted via HTTP GET method. The array variable can be accessed from any script in the program; it has a global scope. This method displays the form values in the URL. It’s ideal for search engine forms as it allows the users to book mark the results. It has the following syntax. <?php $_GET['variable_name']; ?> HERE, “$_GET[…]” is the PHP array “'variable_name'” is the URL variable name.
  • 54. POST VS GET IN PHP POST GET Values not visible in the URL Values visible in the URL Has not limitation of the length of the values since they are submitted via the body of HTTP Has limitation on the length of the values usually 255 characters. This is because the values are displayed in the URL. Note the upper limit of the characters is dependent on the browser. Has lower performance compared to Php_GET method due to time spent encapsulation the Php_POST values in the HTTP body Has high performance compared to POST method dues to the simple nature of appending the values in the URL. Supports many different data types such as string, numeric, binary etc. Supports only string data types because the values are displayed in the URL Results cannot be book marked Results can be book marked due to the visibility of the values in the URL
  • 55. POST VS GET IN PHP
  • 56. FormHandling-using Post Method a.html <html> <body> <form action="welcome.php" method="post"> Name: <input type="text" name="name"> <br> <input type="submit"> </form> </body> </html> Welcome.php <html> <body> Welcome <?php echo $_POST["name"]; ?> </body> </html>
  • 57. Form Handling-using Get Method a.html <html> <body> <form action="welcome.php" method=“get"> Name: <input type="text" name="name"> <br> <input type="submit"> </form> </body> </html> Welcome.php <html> <body> Welcome <?php echo $_GET["name"]; ?> </body> </html>
  • 58. FormHandling- Differencebetweengetand postmethod • $_GET is an array of variables passed to the current script via the URL parameters. • $_POST is an array of variables passed to the current script via the HTTP POST method. • When to use GET? • Information sent from a form with the GET method is visible to everyone. GET also has limits on the amount of information to send. The limitation is about 2000 characters. • When to use POST? • Information sent from a form with the POST method is invisible to others and has no limits on the amount of information to send. • However, because the variables are not displayed in the URL, it is not possible to bookmark the page.
  • 59. Outline Introduction to PHP, Features, sample code, PHP script working, PHP syntax, conditions & Loops, Functions, String manipulation, Arrays & Functions, Form handling, Cookies & Sessions, using MySQL with PHP,
  • 60. Cookie • What is a Cookie? • A cookie is often used to identify a user.A cookie is a small file that the server embeds on the user's computer. Each time the same computer requests a page with a browser, it will send the cookie too. With PHP, you can both create and retrieve cookie values. • Create Cookies With PHP- is created with the setcookie() function. • Syntax • setcookie(name, value, expire, path, domain, secure, httponly); • Only the name parameter is required. All other parameters are optional.
  • 61. Cookie-Create/Retrieve aCookie <?php setcookie(“name”, “Amit”, time() + (86400 * 30), "/"); // 86400 = 1 day ?> <html> <body> <?php if(isset($_COOKIE[“name”])) { $nm=$_COOKIE[“name”]; echo “Hello”,$nm; } else { echo “Coocke is not set”; } ?> </body> </html>
  • 62. Cookie-Modifying aCookie • Tomodify a cookie, just set (again) the cookie using the setcookie() function:
  • 63. Cookie- DeletingCookies <?php // set the expiration date to one hour ago setcookie("user", "", time() - 3600); ?> <html> <body> <?php echo "Cookie 'user' is deleted."; ?> </body> </html>
  • 64. Sessions • A session is a way to store information (in variables) to be used across multiple pages. • Unlike a cookie, the information is not stored on the users computer. • What is a PHP Session? • When you work with an application, you open it, do some changes, and then you close it. This is much like a Session. The computer knows who you are. It knows when you start the application and when you end. But on the internet there is one problem: the web server does not know who you are or what you do, because the HTTP address doesn't maintain state. • Session variables solve this problem by storing user information to be used across multiple pages (e.g. username, favorite color, etc). By default, session variables last until the user closes the browser. • So; Session variables hold information about one single user, and are available to all pages in one application.
  • 65. Sessions- Start aSession • A session is started with the session_start() function. • Session variables are set with the PHP global variable: $_SESSION. • Example - demo_session1.php <?php session_start(); // Start the session ?> <html> <body> <?php $_SESSION["favcolor"] = "green"; // Set session variable echo "Session variables are set."; ?> </body> </html>
  • 66. Sessions: GetSession VariableValues • Next, we create another page called "demo_session2.php". From this page, we will access the session information we set on the first page ("demo_session1.php"). • session variable values are stored in the global $_SESSION variable • Example- demo_session2.php <?php session_start(); ?> <html> <body> <?php // Echo session variables that were set on previous page echo "Favorite color is " . $_SESSION["favcolor"]; ?> </body> </html>
  • 67. Sessions- Modify aSession • Tochange a session variable, just overwrite it: <?php session_start(); ?> <html> <body> <?php // to change a session variable, just overwrite it $_SESSION["favcolor"] = "yellow"; print_r($_SESSION); ?> </body> </html>
  • 68. Sessions: Destroy aSession • Toremove all global session variables and destroy the session, use session_unset() and session_destroy(): • Example- <?php session_start(); ?> <html> <body> // remove all session variables // destroy the session <?php session_unset(); session_destroy(); ?> </body> </html>
  • 69. Outline Introduction to PHP, Features, sample code, PHP script working, PHP syntax, conditions & Loops, Functions, String manipulation, Arrays & Functions, Form handling, Cookies & Sessions, Using MySQL with PHP,
  • 70. Open a Connection toMySQL <?php // Create connection $conn = new mysqli(“localhost”, “root”, “”); //MySQLi extension (the "i" stands for improved) // Check connection if(!$conn){ die('Could not connect: '.mysqli_connect_error()); } echo 'Connected successfully<br/>'; ?>
  • 71. Select Data Froma MySQL Database <?php $conn = mysqli_connect(‘localhost’, ‘root’, ‘root’, ‘db1’); if(!$conn){ die(mysqli_connect_error()); } echo 'Connected successfully<br>'; $sql = 'SELECT * FROM STUD'; $rs=mysqli_query($conn, $sql); $nrows= mysqli_num_rows($rs);
  • 72. Select Data Froma MySQL Database if($nrows > 0){ while($row = mysqli_fetch_assoc($rs)){ echo "ID :{$row['id']} <br>"; echo echo echo "FNAME : {$row['firstname']} <br>"; "LNAME : {$row['lastname']} <br>"; "--------------------------------<br>"; } } else { echo “ No result"; } mysqli_close($conn); ?>
  • 75. WAP-Introduction WAP stands for Wireless Application Protocol WAP is an application communication protocol WAP is used to access services and information WAP is for handheld devices such as mobile phones WAP is a protocol designed for micro browsers WAP enables the creating of web applications for mobile devices. WAP uses the mark-up language WML
  • 76. WAP-Introduction The basic aim of WAP is to provide a web-like experience on small portable devices - like mobile phones and PDAs
  • 77. WAP-Introduction • Purpose of WAP To enable easy, fast delivery of relevant information and services to mobile users. • Type of devices that use WAP Handheld digital wireless devices such as mobile phones, pagers, two-way radios, smart phones and communicators -- from low-end to high-end. • Type of OS that use WAP It can be built on any operating system including Palm OS, EPOC 32, Windows CE, FLEXOS, OS/9, Java O
  • 78. Components of WAPArchitecture Other Services And Applications Application Layer (WAE) GSM CDMA PHS IS-136 CDPD PDC-P FLEX Etc… Session Layer (WSP) Transaction Layer (WTP) Security Layer (WTLS) Transport Layer (WDP) Bearers :
  • 79. Wireless Application Environment(WAE)- components Addressing model –uses URL & URI WML- similar feature like HTML WML script – For user I/P validation WTA(Wireless Telephony Application)
  • 80. WirelessMarkupLanguage (WML) • WML is the markup language defined in the WAP specification. WAP sites are written in WML, while web sites are written in HTML. WML is very similar to HTML. Both of them use tags and are written in plain text format. • WML (Wireless Markup Language), formerly called HDML (Handheld Devices Markup Languages), is a language that allows the text portions of Web pages to be presented on cellular telephones and personal digital assistants (PDAs) via wireless access.
  • 81. Wireless Markup Language • A WML document is made up of multiple cards. • Cards can be grouped together into a deck. WML follows a deck and card. • A user navigates with the WML browser through a series of WML cards. A WML deck is similar to an HTML page.
  • 82. WMLElements text hyperlink (anchor) action goto wml page trigger event (units = tenths of a second) input user text return to previous page value of variable display image set variable <p> </p> <a href=...> </a> <do> </do> <go href=.../> <timer> <input/> <prev/> $(…) <img src=… /> <postfield name=… value=…/> <select > <option> <option> </select> select box
  • 83. WMLStructure < ? xml version=“1.0” ? > <!DOCTYPE wml …> <wml> <card> <p> Text…. </p> <p> Text…… </p> </card> <card> ... </card> </wml>
  • 84. WMLExample <?xml version="1.0"?> <wml> <card id="one" title="First Card"> <p> This is the first card in the deck </p> </card> <card id="two" title="Second Card"> <p> Ths is the second card in the deck </p> </card> </wml>
  • 85. WMLScripts • WMLScript (Wireless Markup Language Script) is the client- side scripting language of WML (Wireless Markup Language). • A scripting language is similar to a programming language, but is of lighter weight. • With WMLScript, the wireless device can do some of the processing and computation. • This reduces the number of requests and responses to/from the server.
  • 86. WAPApplications • Banking: • Finance: • Shopping: • Ticketing: • Entertainment: • Weather: • E- Messaging:
  • 88. AJAX
  • 89. AJAX • What is AJAX? • AJAX = Asynchronous JavaScript And XML. • AJAX is not a programming language. • AJAX just uses a combination of: • A browser built-in XMLHttpRequest object (to request data from a web server) • JavaScript and HTML DOM (to display or use the data)
  • 90. AJAX -Technologies • AJAX cannot work independently. It is used in combination with other technologies to create interactive webpages. • JavaScript • Loosely typed scripting language. • JavaScript function is called when an event occurs in a page. • Glue for the whole AJAX operation. • DOM • API for accessing and manipulating structured documents. • Represents the structure of XML and HTML documents. • CSS • Allows for a clear separation of the presentation style from the content and may be changed programmatically by JavaScript • XMLHttpRequest • JavaScript object that performs asynchronous interaction with the server.
  • 91. AJAX – Real TimeExamples • Here is a list of some famous web applications that make use of AJAX. 1. Google Maps • A user can drag an entire map by using the mouse, rather than clicking on a button. 2. Google Suggest • As you type, Google offers suggestions. Use the arrow keys to navigate the results. 3. Gmail • Gmail is a webmail built on the idea that emails can be more intuitive, efficient, and useful. 4. Yahoo Maps (new) • Now it's even easier and more fun to get where you're going!
  • 93. AJAX ProcessingSteps • Steps of AJAX Operation • A client event occurs. • An XMLHttpRequest object is created. • The XMLHttpRequest object is configured. • The XMLHttpRequest object makes an asynchronous request to the Webserver. • The Webserver returns the result containing XML document. • The XMLHttpRequest object calls the callback() function and processes the result. • The HTML DOM is updated.
  • 94. AJAXExample –table.html <html> <head> <script> var request; function sendInfo() { var v=document.f1.t1.value; var url="index.jsp?val="+v; if(window.XMLHttpRequest){ request=new XMLHttpRequest(); } function getInfo(){ if (request.readyState==4) { var val=request.responseText; document.getElementById('amit').innerHTM L=val; } } </script> </head> of ajax</h1> <body> <h1>This is an example <form name=“f1"> <input type="text" name="t1"> <input type="button" value="ShowTable" onClick="sendInfo()"> </form> <span id="amit"> </span> </body> </html>
  • 97. References • https://www.w3schools.com/php/php_intro.asp • https://www.w3schools.com/php/php_looping.asp • https://www.w3schools.com/php/php_if_else.asp • https://www.w3schools.com/php/php_string.asp • https://www.w3schools.com/php/php_arrays.asp • https://www.w3schools.com/php/php_arrays_multi.asp • https://www.w3schools.com/php/php_forms.asp • https://www.w3schools.com/php/func_array_extract.asp • https://www.w3schools.com/php/func_array_compact.asp • https://www.w3schools.com/php/func_array_in_array.asp • https://www.w3schools.com/php/php_cookies.asp • https://www.w3schools.com/php/php_sessions.asp • https://www.tutorialspoint.com/wap/wap_wml_script.htm • https://www.w3schools.com/xml/ajax_intro.asp • https://www.tutorialspoint.com/ajax/ajax_examples.htm
  • 98. Thank You 98 gharu.anand@gmail.com Blog : anandgharu.wordpress.com Prof. Gharu Anand N. 98