5 Server Side Scripting (PHP)
5 Server Side Scripting (PHP)
Chapter at a Glance
5.1 Introductlon 5.2. Server Side
to PHP Scripting
5.3 features of
PHP
5.4firsf Sample
code of
II
PHP file extension. PHI' Case St'nsitivity, PHP nata Types: - Control structures in PHI' : -
php, how toexecute PHI' variables, rules String, Integer, Float, If statement. if else statement.
PHP program, for declaring 80011.',111, Array, loop structure in PHI' : -
how 10 save code variables, different NUll Comments in For, foreach with syntax and
in specific folder variable scopps PHI', Single line and examples
in PHPwitll multi-line comments,
examples
Function meaning, syntax, Simple HTl\Il form with php code, GET vs POST
fundi on ilrguments, returning " with examples, create database connection object,
value to a function with examples SQL statement and its execution, cookies ,)11(1
sessions in PHI'.
TPS Information Technology (Science) 5-2 Server-Side Scripting (PHP)
13. The statement allows programmer to make decision based on either this
or that condition.
Ans. : if else
14. . are used to execute the same block of code repeatedly as long as certain
condition is satisfied.
Ans.: loop
15. . loop works only on arrays.
Ans. : foreach
16. . functions returns the length of a string.
Ans. : strlenO
17. . functions counts the number of words in a string.
Ans.: stcword_countO
18. . function reverses a string.
Ans. : strrevO
19. . function searches for a specific text within a string.
Ans. : strposO
20. . function replaces some characters with some other characters in a string.
Ans. : stcreplaceO
·21. function returns a part of a string.
Ans. : substrO
22. . function converts a string to lowercase.
Ans. : strtolowerO
23. . function counts the number of times a substring occurs in a string.
Ans. : substr_countO
24. . converts the first character of each word in a string to uppercase.
Ans. : ucwordsO
25. .. . .. .. .. functions removes whitespace and other predefined characters from both
sides of a string.
Ans.: trimO
28. An is a special variable which can hold more than one value at a time.
Ans.: array
29. An stores multiple values in single variable.
Ans.: array
30. The PHP functions is used to create an array variable.
Ans. : arrayO
31. There are types of arrays in PHP.
Ans.: Three
32. The arrays are the arrays with numeric index.
Ans. : Indexed
33. The arrays are the arrays with named keys.
Ans. : Associative
34. The arrays are the arrays containing one or more arrays.
Ans.: Multi-dimensional
35. The function is used to return the length of an array.
Ans. : countO
4. The server side environment that runs a scripting language is termed web server.
Ans. : True
5. PHP hides the code from the user.
Ans. : True
12. The PHP code can also be embedded with HTML tags using <?PHP and? >
Ans.: True
13. PHP files are saved with .htrnl extension.
Ans.: False
14. echo keyword is used to display text on web page.
Ans. : True
15. Variables are used to store values.
Ans. : True
16. A variable starts with $ sign, followed by name of variable.
Ans.: True
17. A variable name can starts with a number.
Ans.: False·
TPS Information Technology (Science) 5-7 Server-Side Scripting (PHP)
18. A variable name can contain only alpha-numeric characters and underscores.
Ans. : True
19. A variable declared outside a function has a GLOBAL SCOPE.
Ans. : True
20. A variable declared within a function has a LOCAL SCOPE.
Ans.: True
21. Variables can store data of different types.
Ans. : True
22. To check data type of variable var _ put ( ) method is used.
Ans.: False
23. Comments are the non executable statement in PHP code.
Ans.: True
24. If statement allows to make decision based on one or more conditions.
Ans. : True
25. For each loop works only on arrays.
Ans.: True
26. StrLengthO function returns the length of a string.
Ans.: False
27. Strword countt) function counts the number of words in a string e,
Ans.: True
28. StrrevO function reverses a string.
Ans. : True
29. Strpost) function returns a string.
Ans. : True
30. Str_replaceO function replaces some characters with some other characters in a
string.
Ans. : True
31. Substrt) function returns a part of a string.
Ans.: True
32. Strlowert) function converts a string to lower case.
Ans.: False
33. Substrjcountt) function counts the number of times a substring occurs in a string.
Ans. : True
34. Ucwordsl) function converts the first characters of each word in a string to
uppercase.
Ans. : True
TPS Information Technology (Science) 5-8 Server-Side Scripting (PHP)
35. trimt) function adds white space and other pre defined characters from both sides of
a string.
Ans.: True
54. The form data is sent with the HTTP Post method.
Ans.: True
55. The PHP superglobals $_GET and $_POST are used to collect form data.
Ans.: True
56. $_GET and $_POST syperglobals which means that theyare never accessible.
Ans.: False
57. $_GET is an array of variables passed via the URL parameters.
Ans.: True
58. $_POST is an array of variables passed via the HTTP POST method.
Ans.: True
59. Information sent from a form with GET method is not visible to everyone.
Ans.: False
60. GET has limits on the amount of information to send.
Ans. : True
61. GET should NEVER be used for sending passwords or other sensitive information.
Ans.: True
62. Information sent from a form with POST method is invisible to everyone.
Ans. : True
63. POST has limits on the amount of information to send.
Ans.: False
TPS Information Technology (Science) 5-10 Server-Side Scripting (PHP)
64. issetO method in PHP is used to check whether variable has value or not.
Ans. : True
65. A cookie is a small text file the client sends on the user's computer.
Ans.: False
66. When browser requests server page, cookies are sent along with the request.
Ans. : True
67. Cookies store visited page on browser to optimize search.
Ans.: True
68. Session is used to store user information on server to track user activities.
Ans. : True
69. Session helps web application to maintain user information on all the pages.
Ans.: True
70. PHP Data Object helps us to connect PHP code in UniformMethod of access to
multiple databases.
Ans.: True
1. ., . .. . . ... . .. .. . ... is a widely used open source server side programming language
which runs on various platforms.
(a) Word (b) PHP (c) Excel (d) PowerPoint
Ans.: (b)
5. The PHP code can also be embedded with HTML tags using , .
(a) <!Php!> (b) <Pphp and T»
(c) <=php> (d) <#php#>
Ans.: (b)
6. PHP files are saved with extension.
(a) .html (b) .xml (c) .js (d) .php
Ans.: (d)
7. . keyword is used to display text on web page.
(a) echo (b) print (c) write (d) cin
Ans.: (a)
8. . is a symbol or name that stands for a value.
(a) Method (b) condition (c) Variable (d) Value
Ans.: (c)
9. A variable in PHP starts with the sign followed by name of the variable.
(a) # (b) @ (c) = (d) $
Ans.: (d)
Ans.: (a)
21. . are used to execute the same block of code repeatedly as long as a certain
condition is satisfied.
(a) Variable (b) Method (c) Object (d) loops
Ans.: (d)
22. ............ loop works only on arrays.
(a) for next (b) for (c) foreach (d) forone
Ans.: (c)
TPS Information Technology (Science) 5-13 Server-Side Scripting (PHP)
35. ..: is a variable which can hold more than one value at a time.
(a) Array (b) Method (c) Object (d) Constant
Ans.: (a)
36. In PHP function is used to create array.
(a) art'() (b) arrayt) (c) valuef) (d) variablet)
Ans.: (b)
37. Syntax of creating array variable is .
(a) @ a = arrayf) (b) #a = arrt)
(c) = arrayi) (d) $a = array (values)
Ans.: (d)
38. There are types of arrays in PHP.
(a) Two (b) One (c) Three (d) Four
Ans.: (c)
39. . arrays are the arrays with a numeric index.
(a) Associative (b) Indexed
(c) Multi-dimensional (d) Normal
Ans.: (b)
40. . arrays are the arrays with named keys.
(a) Indexed (b) Associative
(c) Dimensional (d) Normal
Ans.: (b)
41. . arrays are arrays containing one or more arrays.
(a) Multi-dimensional (b) Indexed
(c) Associative (d) Numbered
Ans.: (a)
TPS Information Technology (Science) 5-15 Server-Side Scripting (PHP)
52. A is a small text file that the server.sends on the user's computer.
(a) Cookie (b) session
(c) Presentation (d) Method
Ans.: (a)
53. ... , are sent along when browser requests server pages.
(a) Cookie (b) Session (c) Method (d) Server
Ans.: (a)
54. . .. , is used to store information on server to track user activities.
(a) Cookie (b) session (c) Presentation (d) Object
Ans.: (b)
55. . helps web application to maintain user information on all the pages.
(a) Session (b) presentation
(c) Cookie (d) object
Ans.: (a)
5.6
....................... ,
(a) inside (b) multiple (c) indexed (d) associate
(e) outside (f) multi-dimensional
Ans. : (c), (d), (f)
PHP is the most popular and frequently used worldwide server-side scripting
language. Following are some of the features of PHP :
• Simple: It is very simple and easy to use, as compared to other scripting languages.
• Interpreted: It is an interpreted language, i.e. there is no need for compilation.
• Open Source: Open source means you need not pay for use of PHP. You can freely
download and use.
• Platform Independent: PHP code will be run on every platform, Linux, Unix, Mac
OS X, Windows.
• Error Reporting: PHP have some predefined error reporting constants to generate a
warning or error notice.
TPS Information Technology (Science) 5-21 Server-Side Scripting (PHP)
The PHP code usually enclosed in a special start and end processing instructions
<?php and?> that allows us to move in to and out of PHP mode. All PHP files have .php
extension.
Simple example to display "Hello world" message on the web page
Coding: .
<!DOCTYPEhtml>
<html>
<body>
<h1>My First Web Page</hl>
<?php
echo "Hello World";
?>
</body>
</html>
Steps to save and execute PHP programs:-
1. Type the above program and save it as "demo.php" using any text editor. (for eg
Notepad, gedit).
2. Create a folder with yourname (for example php).
Note: Create folder in server's root directory. For Ubuntu the path of root directory
is var/www /htmL For Windows the path of root directory is c:/XAMPP /htdocs.
3. Save the "demo.php" file in your folder.
4. Open browser and type in address bar http://localhost/php/.Click on demo.php.
Output :.ibi[§Ji ..21
~ be;!host/pcp/dem"php X
• Variable names are case-sensitive ($name and $name are two different variables)
• There are three different variable scopes in PHP :
1. local
2. global
3. static
A variable declared outside a function has a GLOBAL SCOPE and can only be
accessed outside a function (variable $a). And a variable declared within a function has a
LOCAL SCOPE and can only be accessed within that function (variable $b). In some cases,
if we want a local variable not to be deleted then the use of "static" keyword is must.
Example
PHP Program to print sum of two numbers.
Coding:
<Pphp
$a=lO;
$b=20;
$c=$a+$b;
echo "<brc-cbr> Sum of two numbers is $c";
?>
TPS Information Technology (Science) 5-23 Server-Side Scripting (PHP)
Output:
f- C (j) iocaiho5t'php/,uf]1,pnp
*, e
Sum of two numbers is30
Block of statements;
Block of statements;
TPS Information Technology (Science) 5-25 Server-Side Scripting (PHP)
else
Block of statements;
Example
PHP program to check and print greatest among two numbers.
Coding:
<?php
$a=100;
$b=200;
if($a>$b)
echo "$a is greater than $b";
else
echo "$b is greater than $a";
?>
Output:-
Icca''''os!/phpigreat.php X
C (D loca!host/pi1p/greatphp
Statements of loop;
TPS Information Technology (Science) 5-26 Server-Side Scripting (PHP)
Example
PHP program to print numbers from 1 to 10 using for loop.
Coding:
<?php
for($i=l;$i<=lO;$i++ )
. {
echo "<br> $i";
?>
Output:- x
~ CO (j) tocalhcst/php/tor.php
'}
3
.t
5
6
7
8
9
10
3. Foreach Loop
This loop works only for arrays.
Syntax:-
foreach($array as $value)
{
Statements of loop;
Function Description
strlenl) Returns the length of a string (i.e. total no. of characters)
str_ word_countO Counts the number of words in a string
strrevt) Reverses a string "
strposi) Searches for a specific text within a string and returns the
character position of the first match and if no match is found,
then it will return false
strJeplaceO Replaces some characters with some other characters in a string
substrt) Returns a part of a string
strtolowerO Converts a string to lowercase
substr_countO Counts the number of times a substring occurs ina string
ucwordst) Converts the first character of each word in a string to uppercase
triml) Removes whitespace and other predefined characters from both
sides of a string
Example
PHP program to demonstrate string functions
Coding:
<?php
$a="information technology";
("Information","Inform",$a);
?>
TPS Information Technology (Science) 5-28 Server-Side Scripting (PHP)
Output:
lo::a'rost/phpistrin'SI,p,""p
C ill e
String is information technology
Length of String is 22
Position of 0 in String IS 3
Output:
li!il b~aihost/php/ms9,php X
C CD localhost/php/msg.php
\Ye1come to PHP
Output:
Returning Value:
To let a function return a value, return statement is used.
PHP program to print sum of two numbers using function.
Coding:
<Pphp
$c=$a+$b;
return $c;
?>
TPS Information Technology (Science) 5-29 Server-Side Scripting (PHP)
foreach($x as $value)
?>
Output:
Associative Arrays : - Arrays with named index. This uses name key instead of
index to identify record/value.
Syntax: - $x=(keyl>= valuel, key2>= value2, .... Key n>= value n)
PHP program to print the cost of product store in array variable.
Coding:
<?php
$p = array("Pen"=>"35", "Ball"=>"37", "eraser"=>"43");
echo "cbrc-Pen cost is ".$p['Pen'];
echo "<brc-Eraser cost is ".$p['eraser'];
?>
Output:
array("Volvo",22,18) ,
array("BMW",15,13),
array("Saab",5,2),
array("Land Rover",17,15)
);
echo $cars[O][O].": In stock: ".$cars[O][l].", sold: ".$cars[O][2].".<br>";
echo $cars[l][O].": In stock: ".$cars[l][l].", sold: ".$cars[1][2].".<br>";
echo $cars[2][O].": In stock: ".$cars[2][1].", sold: ".$cars[2][2].".<br>";
echo $cars[3][O].": In stock: ".$cars[3][1].", sold: ".$cars[3][2].".<br>";
?>
statements;
Output:
10+20=30
11+2= 13
31+9=40
Create a HTML form with two input fields to accept number from the user and a
button to print addition of two numbers.
Coding:
Form.html
<html>
<body>
<form action="add.php" method =post">
</form>
</body>
</html>
TPS Information Technology (Science) 5-34 Server-Side Scripting (PHP)
add.php
<?php
$tl=$_ GET["tl "];
$t2=$_GET["t2"];
$c=$tl +$t2;
echo "cbrc-cbr> Sum of two numbers is $c";
?>
Output:
The PHP superglobals $_GET and $_POST are used to collect form data.
GETvsPOST
Both GET and POST are treated as superglobals which means that they are always
accessible regardless of scope. It can be accessed from any function, class or file
without having to do anything special.
Example to create admission form for student. Accept name and gender from the
student. Create a college database and create table student having the fields name
and gender. .
Steps to create database and Table:
1) For database creation ~ open postgres sql terminal=-s create database college; and
press enter.
2) For Table creation -~ create table student(name text, gender Boolean); press enter,
table will be created.
TPS Information Technology (Science) 5-35 Server-Side Scripting (PHP)
$name=$_POST["name"];
$gender=$_POST["gender"];
$sql="INSERT INTO student(name,gender) VALUES (,".$name."','".$gender.''')'';
$conn ->exec($sql);
echo "New record added successfully";
?>
TPS Information Technology (Science) 5-36 Server-Side Scripting (PHP)
(iii) PHP supports several ways of commenting: Single line comment and multi line
comment.
(iv) Single line comment can be written in two ways, they are :-
/ / This is a single-line comment
# This is also a single-line comment
(v) Multi line comment can be written as.-
/* This is a multiple-lines comment block that spans over multiple lines */
9. Explain PHP If statement with syntax.
Ans.:
if statement - executes some code if one condition is true.
Syntax of if statement is
if (condition) {
code to be executed if condition is true;
(iii) Multidimensional arrays - Arrays containing one or more arrays. Fro example :-
$cars = array
(
array("Volvo",22,18),
array("BMW",15,13),
array("Saab",5,2),
array("Land Rover",17,15)
);
<?php
function familyName($fname) {
echo "$fname Refsnes.cbr>":
familyName("Jani");
familyName("Hege");
familyName("Stale");
familyName("Kai Jim");
familylvamei''Borge''):
?>
TPS Information Technology (Science) 5-41 Server-Side Scripting (PHP)
(ii) It can be accessed from any function, class or file without. having to do anything
special.
(iv) $_POST is an array of variables passed via the HTTP POST method.
(ii) A cookie is a small file that the server embeds on the user's computer.
(iii) Each time the same computer requests a page with a browser, it will send the
cookie too.
(iv) With PHP, you can both create and retrieve cookie values.
(b)· Session
(i) Session is used to store user information on server to track user activities.
(ii) It helps in web application to maintain user information on all the pages.
(iii) For example, if you login to gmail account, the session helps to access youtube
account also.
TPS Information Technology (Science) 5-42 Server-Side Scripting (PHP)
1. Write a PHP code which calculates and prints addition, subtraction, multiplication,
division of two numbers using form.
Ans.:
Coding :-
<html>
<body>
<form method=post''>
Enter First Number
<input type="text" name='first'c-cbr>-cbr>
Enter Second Number
<input type='fext'' name="second"><br><br> .
<input type="submit" name='tsubmit" value="Submit">
</form>
</body>
</html>
<?php
if(isset($_POST[' submit'])
{
$first = $_POST['first'];
$second = $_POST['second'];
$sum = $first+$second;
$sub = $first-$second;
$mul = $first*$second;
$div = $first/$second;
echo" <br><br> The Addition is: ".$sum;
echo" <bre-cbr> The Subtraction is: ".$sub;
echo "<brc-cbre-The Multiplication is: ".$mul;
echo "<brc-cbre-The Division is: ".$div;
?>
TPS Information Technology (Science) 5-43 Server-Side Scripting (PHP)
2. Write a PHP code which calculates and prints area and circumference of a circle.
Hint(area=3.14x r- and c=2x3.14xr) using form.
Ans.:
Coding:
<html>
<body>
<form method="post">
Enter Radius
<input type='fext'' nameeradius'c-cbrc-cbrc-
<input type='eubmit'' name="submit" value='Submit"> ..
</form>
</body>
</html>
<?php
if(isset($_POST['submit']) )
{
$p=3.14;
$radius = $_POST['radius'];
$a= $p*$radius*$radius;
$c == $p*2*$radius;
echo "<brc-xbrc-The Area of circle is: ".$a;
echo "<bre-cbrc-The Circumference of circle is: ".$c;
?>
3. Write a PHP code which calculates square of a number using form.
Ans.:
Coding:
<html>
<body>
<form method=rpost">
Enter a Number
<input type="text" nameesq'c-cbrc-cbro
<input type="submit" nameesubmit" value='Sqaure">
TPS Information Technology (Science) 5-44 Server-Side Scripting (PHP)
</form>
</body>
</html>
<?php
if(isset($_POST['submit']))
{
$sq = $_POST['sq'];
$s=$sq*$sq;
echo "<brc-cbrx'Ihe Square of number is: ".$s;
?>
4. Write a PHP code which calculates cube of a number using form.
Ans.:
<html>
<body>
<form method="post">
Enter a Number
<input type="text" name='tsq'c-cbrc-cbr>
<input type="submit" name="submit" value="Cube">
< I form>
</body>
</html>
<?php
if(isset( $_POST[' submit']) )
{
$sq = $_POST['sq'];
$s=$sq*$sq*$sq;
echo "<brc-cbre-The Cube of number is: ".$s;
?>
TPS Information Technology (Science) 5-45 Server-Side Scripting (PHP)
5. Write a PHP code to check and print greatest among two numbers using form an
function.
Ans.:
Coding:
<html>
<body>
dorm method=post">
Enter First Number
<input type='fext" name='f'c-cbrc-cbr>
Enter Second Number
<input type="text" name="s"><br><br>
<input type="submit" name="submit" value="Greatest">
</form>
.</body>
</html>
<?php
function grtt)
{
if(isset($_POST['submit'J))
{
$f = $_POST['f'];
$s = $_POST['s'];
if($f>$s)
echo" <br><br>The greater number is " .$f;
else
echo" <bre-xbr> The greater number is " .$s;
grtt):
?>
TPS Information Technology (Science) 5-46 Server-Side Scripting (PHP)
6. Write a PHP code to check and print greatest among three numbers using form.
Ans.:
Coding:
<html>
<body>
<form method=l'post">
Enter First Number
<input type='fext" name="f"><br><br>
Enter Second Number
<input type="text" namees'c-cbro-cbr>
Enter Third Number
<input type="text" namev'f'c-cbro-cbr>
<input type="submit" name="submit" value="Greatest 3">
</form>
</body>
</htm1>
<?php
function grtO
if(isset($_POST['submit'])
{
$f = $_POST['£'];
$s = $_POST['s'];
$t = $_POST['t'];
if($f>$s && $f>$t)
echo "<bre-cbrc-The greater number is" .$f;
else
grtt):
?>
7. Write a PHP code to check and print whether the number is Odd or Even using
form.
Ans.:
Coding:
<html>
<body>
<form method=post">
Enter a Number
<input type='fext" name=T'e-cbr>«br>
<input type=Hsubmit" name='tsubmit'' value='Even Odd">
</form>
</body>
</html>
<?php
if(isset($_POST['submit'])
{
$f = $_POST['£,];
if($f%2==O)
echo "<brc-xbrc-The number is Even number";
else
echo "<bre-cbr> The number is Odd number";
?> ..
TPS Information Technology (Science) 5-48 Server-Side Scripting (PHP)
8. Write a PHP code to check and print whether the number is positive, negative or
Zero using form.
Ans.:
Coding:
-chtml»
<body>
<form method="post">
Enter a Number
<input typee'fexr" namee'f'c-cbre-cbr»
<input type="submit" name="submit" value="Positive Negative Zero">
</form>
</body>
</html>
<?php
if(isset($_POST['submit'D)
{
$f = $_POST['f'];
if($f>O)
echo "<bre-cbrc-Thenumber is Positive number";
else
if($f<O)
echo "<brc-cbre-Thenumber is Negative number";
else
echo "<bre-cbrc-Thenumber is Zero";
?>
9. Write a PHP code to print even numbers between 1-20.
Ans.:
Coding:
<?php I
for($i=2;$i<=20;$i=$i+2)
~{~---<
TPS Information Technology (Science) 5-49 Server-Side Scripting (PHP)
echo "<br>".$i;
?> I
10. Write a PHP code to input a number and print the factorial of a number.
Ans.:
Coding:
<html>
<body>
<form method=Ipost">
Enter a Number
<input type='fext" name="f"><br><br>
<input type="submit" name=t'submit" value="Factorial">
</form>
</body>
</html>
<?php
$fc=l;
if(isset($_POST['submit']) )
{
$f = $_POST['f];
for($i=$f;$i>=l;$i-- )
{
$fc=$fc*$i;
?>
11. Write a PHP code to print multiplication table of a number.
Ans.:
Coding:
<html>
<body>
<form method;::"post">
TPS Information Technology (Science) 5-50 Server-Side Scripting (PHP)
Enter a Number
<input type="text" name=T'c--cbrc-cbr>
<input type="submit" name=rsubmit'' value=Table">
</form>
</body>
</html>
<Pphp
if(isset($_POST['submit'D)
{
$f ==$_POST['£,];
for($i=1;$i<=10;$i++ )
{
$m=$f*$i;
echo "<brc--cbr> ".$f. "x".$i."=".$m;
J
?>
12. Write a PHP code to check whether the number is prime number or not.
Ans.:
Coding:
<html>
<body>
<form method='tpost">
Enter a Number
<input type="text" namee'f'c-cbrc-cbrc-
<input type="submit" nameesubmit" value="Prime number">
</form>
</body>
</html>
<?php
$p==l;
if(isset($ _POST['submit'D)
TPS Information Technology (Science) 5-51 Server-Side Scripting (PHP)
for($i=2;$i <$f;$i++)
{
H($f%$i ==0)
$p=O;
}
H($p==l)
echo "<brc-cbre-Number is Prime Number";
else
echo "<bre-cbrc-Number is not a Prime Number";
?>
13. Write a PHP code to count the number of words in the given string.
Ans.:
Coding:
<?php
$a="Hypertext Preprocessor";
echo "<bre-cbr> String is ".$a;
echo "<bre-cbr> Words in String is "strword countrsa):
?>
14. Create a website with two PHP webpage in which each webpage is connected. The
first page of the website contains two form fields for taking 'name' and 'password'
from users. On onclick event, details of forms should be displayed on second web
page.
Ans.:
Coding:
Form.html
<html>
<body>
<form action="wc.php" method="post">
Enter Name
<input type="text" namee'tname'c-cbrc-cbr»
Enter Password
<input type="password" name="pass"><br><br>
<input type="submit" name="submit" value='Submit''>
TPS Information Technology (Science) 5-52 Server-Side Scripting (PHP)
</form>
</body>
</html>
wc.php
<html>
<body>
Welcome
<?php
echo $_POST["name"]; 't» <bre-cbr>
Your Password is
<Pphp
echo $_POST["pass"];
?>
State TruelFalse
Brief Questions
1. Explain any two features of PHP?
Ans.: Refer answer the following Ql 5.3
2. What are the rules to declare variable inPHP?
Ans.: Refer answer the following Q3 5.4
3. What is server side scripting?
. Ans. : Refer answer the following Ql 5.2
4. List the supported datatypes in PHP
Ans. : Refer answer the following Q5 5.4
5. Explain any two string manipulation function.
Ans. : Refer answer the following Ql 5.5
ODD