SlideShare a Scribd company logo
1 of 36
INDEX
S.No Date Name of the Experiment Page. No Signature
1 Create PHP script to perform any five String
functions for a given strings.
2 Develop the PHP script to perform array operation.
3 Develop the PHP script to find the day difference
between two dates.
4 Design and develop the user interface by using
generic control in PHP.
5 Design and develop the user interface by using
advanced control in PHP.
6 Develop the user interface for client side
validation.
7 Develop a PHP application for MYSQL database
connection.
8 Develop a PHP script with Session and Cookie.
9 Develop a PHP application for send an Email.
10 Create a PNG file with different shapes.
Exercise: 1
Date :
Create PHP script to perform any five String functions for a given strings.
Aim:
To create a PHP web page for perform the string function operation for a given string.
Algorithm:
Step 1 : Start the process
Step 2: Define PHP script tags
Step 3 : Use the strlen() function to display the length of a sting.
Step 4: Use the str_replace() to replace the existing string values.
Sept 5: Use the strtolower() for convert the given string into lower case.
Sept 6: Save the file with .PHP extension
Step 7: Display the output in the Browser
Step 8: Stop the process
PHP Script
.php
<?php
echo("length:").strlen("all the best");
echo"<br/>";
echo str_word_count("all the best");
echo"<br/>";
echo strrev("all the best");
echo"<br/>";
echo strpos("all the best","best");
echo"<br/>";
echo str_replace("all","god is","all the best");
echo"<br/>";
echo strtoupper("all the best");
echo"<br/>";
echo strtolower("ALL THE BEST");
echo"<br/>";
echo ucfirst("all the best");
echo"<br/>";
echo ucwords("all the best");
echo"<br/>";
?>
OUTPUT:
length:12
3
tseb eht lla
8
god is the best
ALL THE BEST
all the best
All the best
All The Best
Result:
Thus the above string function PHP script has been successfully designed and displays the
output.
Exercise: 2
Date :
Develop the PHP script to perform array operation.
Aim:
To develop a PHP web page for perform the array based operation using built-in functions.
Algorithm:
Step 1: Start the process
Step 2: Define PHP script tags
Step 3: Use the array () function to create the array.
Step 4: Use the in_array () function to find the give element is available or not in the array.
Sept 5: Use the sort() function to sort elements in the array.
Step 6: Use th earray_sum() function to produce the summation of array values.
Sept 7: Save the file with .PHP extension
Step 8: Display the output in the Browser Step
Step 9: Stop the process
PHP Script
.php
<?php
echo"<h1><center> Array Program </center></h1>";
$roll_no = array("191ca001","191ca002","191ca003","191ca004","191ca005");
$find_rollno="191ca003";
echo "Array elements are :<br>";
echo print_r($roll_no," ");
echo "<br> Find the Elements in the Array :<br>";
if(in_array($find_rollno,$roll_no))
{
echo"$find_rollno found";
}
else
{
echo"$find_rollno not found";
}
$num_array1=array(1,2,3,4,5);
$num_array2=array(1,2,3,4,6);
sort($num_array1);
echo"<br> Array1 <br>";
echo print_r($num_array1," ");
echo"<br> Array count<br>";
echo count($num_array1);
echo"<br> Array2 <br>";
echo print_r($num_array2," ");
echo "<br>Array Difference<br>";
echo print_r(array_diff($num_array1,$num_array2)," ");
echo "<br> Sum of Array=".array_sum($num_array1);
?>
Output:
Array Program
Array elements are :
Array ( [0] => 191ca001 [1] => 191ca002 [2] => 191ca003 [3] => 191ca004 [4] => 191ca005 )
Find the Elements in the Array :
191ca003 found
Array1
Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 )
Array count
5
Array2
Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 6 )
Array Difference
Array ( [4] => 5 )
Sum of Array=15
Result:
Thus the above array functions PHP script has been successfully designed and displays the
output.
Exercise: 3
Date :
Develop the PHP script to find the day difference between two dates.
Aim:
To develop a PHP web page for finding number of days between two dates using functions.
Algorithm:
Step 1 : Start the process
Step 2: Define PHP script tags
Step 3: Declare the required variable for store the dates.
Step 4 : Define the dateDiffInDays () function and pass given dates.
Sept 5: Return the result from the function.
Sept 6: Save the file with .PHP extension
Step 7: Display the output in the Browser
Step 8: Stop the process
PHP Script
.php
<?php
function dateDiffInDays($date1,$date2)
{
$diff=strtotime($date2)-strtotime($date1);
return abs(round($diff/86400));
}
$date1="25-09-2020";
$date2="31-01-2021";
$dateDiff=dateDiffInDays($date1,$date2);
printf("Difference between two dates:".$dateDiff."Days");
?>
Output:
Difference between two dates: 128 Days
Result:
Thus the above user defined functions for find the number of days between two dates PHP
script has been successfully designed and displays the output.
Exercise: 4
Date :
Design and develop the user interface by using generic control in PHP.
Aim:
To design and develop a PHP web page for prepare the student result, grade and average of a
mark statement by using of generic control.
Algorithm:
Step 1 : Start the process
Step 2: Design the user interface in a HTML file.
Step 3: Use the FORM element and send user inputs to server.
Step 4 : Develop the PHP script for read the user entered values.
Sept 5: Use the $_REQUEST PHP variable for and store the input.
Sept 6: Save the files .HTML and .PHP extension.
Step 7: Display the output in the Browser
Step 8: Stop the process
HTML Design
.HMTL
<html>
<h1><center>Student Mark Statement</center></h1>
<body>
Enter The Data
<form action="191ca003 6.php" method="get">
ENTER REG NO :
<input type="text" name="Regno">
<br>
ENTER SUBJECT 1 MARK:
<input type="text" name="m1">
<br>
ENTER SUBJECT 2 MARK:
<input type="text" name="m2">
<br>
ENTER SUBJECT 3 MARK:
<input type="text" name="m3">
<br>
ENTER SUBJECT 4 MARK:
<input type="text" name="m4">
<br>
ENTER SUBJECT 5 MARK:
<input type="text" name="m5">
<br>
<input type="checkbox" name="tl">
:TOTAL
<input type="checkbox" name="PF">
:RESULT
<input type="checkbox" name="G">
:AVERAGE
<br>
<center><input type="submit" value="SUBMIT"></center>
</form>
</body>
</html>
Php script
.PHP
<html>
<body>
<h1><center> STUDENT RESULT </center></h1>
<?php
$regno=$_REQUEST["Regno"];
echo "REG NO :".$regno;
echo "<br>";
$a=$_REQUEST["m1"];
$b=$_REQUEST["m2"];
$c=$_REQUEST["m3"];
$d=$_REQUEST["m4"];
$e=$_REQUEST["m5"];
$total=$a+$b+$c+$d+$e;
if(isset($_REQUEST["tl"]))
echo ("TOTAL :".$total);
echo"<br>";
if(isset($_REQUEST["PF"]))
{ echo"RESULT :";
if($a>=35&&$b>=35&&$c>=35&&$d>=35&&$e>=35)
echo " PASS ";
else
echo"FAIL";
}
echo "<br>";
if(isset($_REQUEST["G"]))
{
echo ("AVERAGE : ".$total/5);
echo "<br>";
}
if ($total<280&&$total>=250)
echo"GRADE A";
else if($total<250&&$total>=200)
echo "GRADE B";
else
echo " GRADE C";
?>
</body>
</html>
Output:
Result:
Thus the above student mark entry user interface HTML design and producing the result PHP
script has been successfully designed and displays the output.
Exercise: 5
Date :
Design and develop the user interface by using advanced control in PHP.
Aim:
To design and develop a web page for hotel room booking user interface by using of generic
control.
Algorithm:
Step 1 : Start the process
Step 2: Design the user interface in a HTML file with advanced controls.
Step 3: Use the FORM element and send user inputs to server.
Step 4 : Develop the PHP script for read the user entered values.
Sept 5: Use the $_REQUEST PHP variable for and store the input.
Sept 6: Save the files .HTML and .PHP extension.
Step 7: Display the output in the Browser
Step 8: Stop the process
HTML Design
.HMTL
<html>
<body bgcolor="#FFFFBB">
<img src="hotel123.jpg" width="100%" height="25%">
</img>
<center>
<table border="1" style="font-size:30">
<tr style="color:red">
<td bgcolor="green" colspan="2">
<h1><center> ROOM BOOKING </center></h1>
</td>
</tr>
<form method="post" action="191ca0037.php" >
<tr bgcolor="yellow">
<td>
ARRIVAL :
</td>
<td>
DEPATURE :
</td>
</tr>
<tr>
<td>
<input type="datetime-local" name="c1">
</td>
<td>
<input type="datetime-local" name="c2">
</td>
</tr>
<tr bgcolor="yellow">
<td>
No.Of.Adults :
</td>
<td>
No.Of.Childrens :
</td>
</tr>
<tr>
<td>
<Select name="adults">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
</td>
<td>
<Select name="children">
<option>0</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
</td>
</tr>
<tr>
<td bgcolor="yellow">
No.Of.Rooms :
</td>
<td>
<input type="text" name="room">
</td>
</tr>
<tr>
<td bgcolor="yellow">
ROOM TYPE :
</td>
<td bgcolor="white">
<input type="radio" value="DELUX" name="type1">
DELUX
<br>
<input type="radio" value="A/C" name="type1">
A/C
<br>
<input type="radio" value="NON A/C" name="type1">
NON A/C
</td>
</tr>
<tr>
<td bgcolor="yellow">
Mode Of Payment
</td>
<td bgcolor="white">
<input type="radio" value= "CASH" name="pay">
CASH
<input type="radio" value="CARD" name="pay">
CARD
</td>
</tr>
<tr>
<td bgcolor="yellow">
Maid ID:
</td>
<td>
<input type="text" name="id">
</td>
</tr>
<tr>
<td bgcolor="yellow">
Contact No :
</td>
<td>
<input type="text" name="no">
</td>
</tr>
<tr><td colspan="2">
<center><input type="submit" value="BOOK MY ROOM"></center>
</td>
</tr>
</table>
</center>
</body>
</html>
Php script
.PHP
<?php
echo "<font color='RED'>";
echo"<center>BOOKING CONFIRMATION</center>";
echo "</font>";
echo "<br>";
echo "<br>";
echo "<font color='BLUE'>";
echo"From : ";
$adate=date_create($_REQUEST["c1"]);
echo date_format($adate,'d-m-Y');
echo"To:";
$ddate=date_create($_REQUEST["c2"]);
echo date_format($ddate,'d-m-Y');
echo "<br>";
echo "<br>";
echo (" No of Rooms :".$_REQUEST["room"]);
echo "<br>";
echo "<br>";
$adult=$_REQUEST["adults"];
$child=$_REQUEST["children"];
echo ($_REQUEST["type1"]." ROOM BOOKED FOR ".$adult." ADULT ".$child."
CHILDREN");
echo "<br>";
echo "<br>";
echo ("YOUR PAYEMENT IS COMPLETED SUCCESSFULLY AND YOUR PAYMENT
MODE IS ".$_REQUEST["pay"]);
echo "<br>";
echo "<br>";
echo("THE CONFIRMATION SEND TO THE FOLLOWING MAIL ID : ");
echo"<font color='RED'>";
echo($_REQUEST["id"]);
echo "</font>";
echo "OR CONTACT NO : " ;
echo"<font color='RED'>";
echo($_REQUEST["no"]);
echo "</font>"
?>
Output:
Result:
Thus the above hotel room booking user interface HTML design and producing the
confirmation PHP script has been successfully designed and displays the output.
Exercise: 6
Date :
Develop the user interface for client side validation.
Aim:
To develop registration page with client side validation for the user entered input in PHP and
Java Script.
Algorithm:
Step 1 : Start the process
Step 2: Design the user interface.
Step 3: Use the FORM element and call the formValidator() function.
Step 4 : Develop Java Script for validating the user inputs.
Sept 5: Define the required Java Script functions.
Sept 6: Save the files .PHP extension.
Step 7: Display the output in the Browser
Step 8: Stop the process
Java Script and PHP
.PHP
<script type='text/javascript'>
function formValidator(){
var firstname=document.getElementById('firstname');
var addr=document.getElementById('addr');
var zip=document.getElementById('zip');
var username=document.getElementById('username');
var email=document.getElementById('email');
if (isAlphabet(firstname,"Please enter only letters for your name")){
if (isAlphanumeric(addr,"Numbers and Letters Only for Address")){
if (isNumeric(zip,"Please enter a vaild zip code")){
if(madeSelection(state,"Please Choose a State")){
if (emailValidator(email,"Please enter a vaild email address")){
return true;
}
}
}
}
}
return false;
}
function notEmpty(elem,helperMsg){
if(elem.value.length==0){
alert(helperMsg);
elem.focus();
return false;
}
return true;
}
function isNumeric(elem,helperMsg){
var numericExpression=/^[0-9]+$/;
if(elem.value.match(numericExpression)){
return true;
}else{
alert(helperMsg);
elem.focus();
return false;
}
}
function isAlphabet(elem,helperMsg){
var alphaExp=/^[a-zA-Z]+$/;
if(elem.value.match(alphaExp)){
return true;
}else{
alert(helperMsg);
elem.focus();
return false;
}
}
function isAlphanumeric(elem,helperMsg){
var alphaExp=/^[0-9a-zA-Z]+$/;
if(elem.value.match(alphaExp)){
return true;
}else{
alert(helperMsg);
elem.focus();
return false;
}
}
function madeSelection(elem,helperMsg){
if(elem.value=="please Choose"){
alert(helperMsg);
elem.focus();
return false;
}else{
return true;
}
}
function emailValidator(elem,helperMsg){
var emailExp=/^[w-.+]+@[a-zA-Z0-9.-]+.[a-zA-z0-9]{2,4}$/;
if(elem.value.match(emailExp)){
return true;
}else{
alert(helperMsg);
elem.focus();
return false;
}
}
</script>
<html>
<h1><center>Registration form</center></h1>
<form onsubmit='return formValidator()'action='191ca003 9.php'>
<table border="2" align="center">
<tr>
<td width="100">
First Name: <input type='text' id='firstname' /><br/>
</td>
</tr>
<tr>
<td>
Address:<input type='text' id='addr'/><br/>
</td>
</tr>
<tr>
<td>
zip code:<input type='text' id='zip'/><br/>
</td>
</tr>
<tr>
<td>
state: <select id='state'>
<option>Please Choose</option>
<option>TN</option>
<option>KA</option>
<option>UB</option>
<option>MH</option>
</select><br/>
</td>
</tr>
<tr>
<td>
Username :<input type='text' id='username'/><br/>
</td>
</tr>
<tr>
<td>
Email :<input typr='text' id='email'/><br/>
</td>
</tr>
<tr>
<td>
<input type='submit' value='Check Form' name='b1'/>
</td>
</tr>
</table>
</form>
<?php
if(isset($_REQUEST['b1']))
{
echo "DATA IS VALID";
}
?>
</html>
Output:
Result:
Thus the above registration page client side data validation has been successfully designed and
displays the output.
Exercise: 7
Date :
Develop a PHP application for MYSQL database connection.
Aim:
To develop a student data retrieval page in PHP.
Algorithm:
Step 1 : Start the process
Step 2: Create the MYSQL database.
Step 3: Create the student table in MYSQL database.
Step 4: Insert the values to the student table.
Sept 5: Create the connection object using mysqli().
Sept 6: Retrieve the data from the table using SELECT query.
Step 7: Display the output each in retrieved row in the Browser.
Step 8: Close the MYSQL connection.
Step 9: Stop the process
.PHP
<?php
$conn=new mysqli("192.168.24.191","student","student","191ca003db");
if(!$conn){
die('COULD NOT CONNECTED;'.mysql_error());
}
echo('CONNECTED SUCCESSFULLY');
ECHO"<BR>";
ECHO"<BR>";
$a="select*from mytable3";
$result=$conn->query($a);
if($result->num_rows>0){
while($row=$result->fetch_assoc()){
echo"NAME:".$row["name"]."-ROLL NO:".$row["rno"]."<br>";
}
}else
{
echo"0 results";
}
mysqli_close($conn);
?>
OUTPUT:
Result:
Thus the above MYSQL database connection to the PHP application has been successfully
designed and displays the output.
Exercise: 8
Date :
Develop a PHP script with Session and Cookie.
Aim:
To develop a College home page for display the visit count using session and cookie in PHP.
Algorithm:
Step 1 : Start the process
Step 2: Design the college home page.
Step 3: Set the cookies value using setcookie().
Step 4: Use the $_COOKIE variable for store the value.
Step 5: Display the total number of visits.
Step 6: Stop the process
.PHP
<html>
<head>
<title>PHP CODE TO COUNT NUMBER OF VISITORS USING COOKIES </title>
</head>
<h1><center>WELCOME TO DR.N.G.P ARTS AND SCIENCE COLLEGE</center></h1>
<ul>COURSES
<li>BCA</li>
<li>BBA</li>
<li>B.Sc(CS)</li>
<li>B.Com</li>
<li>B.Sc(IT)</li>
</ul>
<?php
if(!isset($_COOKIE['count'])){
echo"WELCOME THIS IS THE FIRST TIME YOU VIEWED THIS PAGE";
$cookie=1;
setcookie("count",$cookie);
}
else
{
$cookie=++$_COOKIE['count'];
setcookie ("count",$cookie);
echo "YOU HAVE VIEWED THIS PAGE ".$_COOKIE['count']."TIMES";
}
?>
</BODY>
</html>
OUTPUT:
Result:
Thus the above college home page number of visit application using session and cookie value
has been successfully designed and displays the output.
Exercise: 9
Date :
Develop a PHP application for send an Email.
Aim:
To develop a PHP application to send a leave email.
Algorithm:
Step 1 : Start the process.
Step 2: Define the mail properties.
Step 3: Set the cookies value using setcookie().
Step 4: Use the $_COOKIE variable for store the value.
Step 5: Display the total number of visits.
Step 6: Stop the process.
.PHP
<html>
<head>
<title>SENDING HTML EMAIL USING PHP</title>
</head>
<body>
<?php
$to="191ca003@drngpasc.ac.in";
$subject="LEAVE REQUEST";
$message=("<b>I AM REQUESTING LEAVE ON 10/05/2022"."<H1>AKASH P </h1>");
$header=("From:bca2022@gmail.comrn"."MINE-Version: 1.0rn"."Content-type:
text/htmlrn");
$retval=mail ($to,$subject,$message,$header);
if($retval == true)
echo"MESSAGE SENT SUCCESSFULLY.....";
else
echo"MESSAGE COULD NOT SENT....";
?>
</BODY>
</html>
OUTPUT:
Result:
Thus the above leave email PHP script has been successfully designed and displays the output.
Exercise: 10
Date :
Create a PNG file with different shapes.
Aim:
To Create PHP web page to display the different shapes in a PNG.
Algorithm:
Step 1 : Start the process
Step 2: Define image size using imagecreate().
Step 3: Set the color of the images using imagecolorallocate().
Step 4: Use the different image function for forming the shapes in the PNG.
Step 5: Display the shapes with PNG in PHP.
Step 6: Stop the process
.PHP
<?php
header('content-type:image/png');
$png_image=imagecreate(300,300);
$grey=imagecolorallocate($png_image,229,229,229);
$green=imagecolorallocate($png_image,128,204,204);
imagefilltoborder($png_image,0,0,$grey,$grey);
imagefilledrectangle($png_image,20,20,80,80,$green);
imagefilledrectangle($png_image,100,20,280,80,$green);
imagefilledellipse($png_image,50,150,75,75,$green);
imagefilledellipse($png_image,200,150,150,75,$green);
$poly_points=array(150,200,100,280,200,280);
imagefilledpolygon($png_image,$poly_points,3,$green);
imagepng($png_image);
imagedestroy($png_image);
?>
OUTPUT:
Result:
Thus the above different shapes with PNG image in PNP has been successfully designed and
displays the output.

More Related Content

Similar to PHP Lab template for lecturer log book- and syllabus

PHP BASIC PRESENTATION
PHP BASIC PRESENTATIONPHP BASIC PRESENTATION
PHP BASIC PRESENTATIONkrutitrivedi
 
Developing web applications
Developing web applicationsDeveloping web applications
Developing web applicationssalissal
 
Lean Php Presentation
Lean Php PresentationLean Php Presentation
Lean Php PresentationAlan Pinstein
 
What To Expect From PHP7
What To Expect From PHP7What To Expect From PHP7
What To Expect From PHP7Codemotion
 
Workshop quality assurance for php projects tek12
Workshop quality assurance for php projects tek12Workshop quality assurance for php projects tek12
Workshop quality assurance for php projects tek12Michelangelo van Dam
 
Django Introduction & Tutorial
Django Introduction & TutorialDjango Introduction & Tutorial
Django Introduction & Tutorial之宇 趙
 
Php interview questions
Php interview questionsPhp interview questions
Php interview questionssekar c
 
PHP Unit-1 Introduction to PHP
PHP Unit-1 Introduction to PHPPHP Unit-1 Introduction to PHP
PHP Unit-1 Introduction to PHPLariya Minhaz
 
Max Voloshin - "Organization of frontend development for products with micros...
Max Voloshin - "Organization of frontend development for products with micros...Max Voloshin - "Organization of frontend development for products with micros...
Max Voloshin - "Organization of frontend development for products with micros...IT Event
 
HTML5 tutorial: canvas, offfline & sockets
HTML5 tutorial: canvas, offfline & socketsHTML5 tutorial: canvas, offfline & sockets
HTML5 tutorial: canvas, offfline & socketsRemy Sharp
 
Learn Dashing Widget in 90 minutes
Learn Dashing Widget in 90 minutesLearn Dashing Widget in 90 minutes
Learn Dashing Widget in 90 minutesLarry Cai
 
symfony on action - WebTech 207
symfony on action - WebTech 207symfony on action - WebTech 207
symfony on action - WebTech 207patter
 
RESTful API development in Laravel 4 - Christopher Pecoraro
RESTful API development in Laravel 4 - Christopher PecoraroRESTful API development in Laravel 4 - Christopher Pecoraro
RESTful API development in Laravel 4 - Christopher PecoraroChristopher Pecoraro
 
Symfony2 Introduction Presentation
Symfony2 Introduction PresentationSymfony2 Introduction Presentation
Symfony2 Introduction PresentationNerd Tzanetopoulos
 
CodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkCodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkBo-Yi Wu
 
把鐵路開進視窗裡
把鐵路開進視窗裡把鐵路開進視窗裡
把鐵路開進視窗裡Wei Jen Lu
 
Please look at the attach See.doc. I am getting this error all th.docx
Please look at the attach See.doc. I am getting this error all th.docxPlease look at the attach See.doc. I am getting this error all th.docx
Please look at the attach See.doc. I am getting this error all th.docxrandymartin91030
 

Similar to PHP Lab template for lecturer log book- and syllabus (20)

flask.pptx
flask.pptxflask.pptx
flask.pptx
 
PHP BASIC PRESENTATION
PHP BASIC PRESENTATIONPHP BASIC PRESENTATION
PHP BASIC PRESENTATION
 
Developing web applications
Developing web applicationsDeveloping web applications
Developing web applications
 
Lean Php Presentation
Lean Php PresentationLean Php Presentation
Lean Php Presentation
 
What To Expect From PHP7
What To Expect From PHP7What To Expect From PHP7
What To Expect From PHP7
 
Workshop quality assurance for php projects tek12
Workshop quality assurance for php projects tek12Workshop quality assurance for php projects tek12
Workshop quality assurance for php projects tek12
 
Django Introduction & Tutorial
Django Introduction & TutorialDjango Introduction & Tutorial
Django Introduction & Tutorial
 
Php interview questions
Php interview questionsPhp interview questions
Php interview questions
 
PHP Unit-1 Introduction to PHP
PHP Unit-1 Introduction to PHPPHP Unit-1 Introduction to PHP
PHP Unit-1 Introduction to PHP
 
Django crush course
Django crush course Django crush course
Django crush course
 
Max Voloshin - "Organization of frontend development for products with micros...
Max Voloshin - "Organization of frontend development for products with micros...Max Voloshin - "Organization of frontend development for products with micros...
Max Voloshin - "Organization of frontend development for products with micros...
 
HTML5 tutorial: canvas, offfline & sockets
HTML5 tutorial: canvas, offfline & socketsHTML5 tutorial: canvas, offfline & sockets
HTML5 tutorial: canvas, offfline & sockets
 
2009-02 Oops!
2009-02 Oops!2009-02 Oops!
2009-02 Oops!
 
Learn Dashing Widget in 90 minutes
Learn Dashing Widget in 90 minutesLearn Dashing Widget in 90 minutes
Learn Dashing Widget in 90 minutes
 
symfony on action - WebTech 207
symfony on action - WebTech 207symfony on action - WebTech 207
symfony on action - WebTech 207
 
RESTful API development in Laravel 4 - Christopher Pecoraro
RESTful API development in Laravel 4 - Christopher PecoraroRESTful API development in Laravel 4 - Christopher Pecoraro
RESTful API development in Laravel 4 - Christopher Pecoraro
 
Symfony2 Introduction Presentation
Symfony2 Introduction PresentationSymfony2 Introduction Presentation
Symfony2 Introduction Presentation
 
CodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkCodeIgniter PHP MVC Framework
CodeIgniter PHP MVC Framework
 
把鐵路開進視窗裡
把鐵路開進視窗裡把鐵路開進視窗裡
把鐵路開進視窗裡
 
Please look at the attach See.doc. I am getting this error all th.docx
Please look at the attach See.doc. I am getting this error all th.docxPlease look at the attach See.doc. I am getting this error all th.docx
Please look at the attach See.doc. I am getting this error all th.docx
 

More from KavithaK23

PHP record- with all programs and output
PHP record- with all programs and outputPHP record- with all programs and output
PHP record- with all programs and outputKavithaK23
 
CRUD OPERATIONS using MySQL connectivity in php
CRUD OPERATIONS using MySQL connectivity in phpCRUD OPERATIONS using MySQL connectivity in php
CRUD OPERATIONS using MySQL connectivity in phpKavithaK23
 
Unit 4 - 2.docx
Unit 4 - 2.docxUnit 4 - 2.docx
Unit 4 - 2.docxKavithaK23
 
unit 4 - 1.pdf
unit 4 - 1.pdfunit 4 - 1.pdf
unit 4 - 1.pdfKavithaK23
 
unit 2 -program security.pdf
unit 2 -program security.pdfunit 2 -program security.pdf
unit 2 -program security.pdfKavithaK23
 

More from KavithaK23 (10)

PHP record- with all programs and output
PHP record- with all programs and outputPHP record- with all programs and output
PHP record- with all programs and output
 
CRUD OPERATIONS using MySQL connectivity in php
CRUD OPERATIONS using MySQL connectivity in phpCRUD OPERATIONS using MySQL connectivity in php
CRUD OPERATIONS using MySQL connectivity in php
 
unit 3.pdf
unit 3.pdfunit 3.pdf
unit 3.pdf
 
Unit III.docx
Unit  III.docxUnit  III.docx
Unit III.docx
 
Unit 4 - 2.docx
Unit 4 - 2.docxUnit 4 - 2.docx
Unit 4 - 2.docx
 
unit 4 - 1.pdf
unit 4 - 1.pdfunit 4 - 1.pdf
unit 4 - 1.pdf
 
unit 5 -2.pdf
unit 5 -2.pdfunit 5 -2.pdf
unit 5 -2.pdf
 
unit 5 -1.pdf
unit 5 -1.pdfunit 5 -1.pdf
unit 5 -1.pdf
 
UNIT 5.docx
UNIT 5.docxUNIT 5.docx
UNIT 5.docx
 
unit 2 -program security.pdf
unit 2 -program security.pdfunit 2 -program security.pdf
unit 2 -program security.pdf
 

Recently uploaded

SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 

Recently uploaded (20)

SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 

PHP Lab template for lecturer log book- and syllabus

  • 1. INDEX S.No Date Name of the Experiment Page. No Signature 1 Create PHP script to perform any five String functions for a given strings. 2 Develop the PHP script to perform array operation. 3 Develop the PHP script to find the day difference between two dates. 4 Design and develop the user interface by using generic control in PHP. 5 Design and develop the user interface by using advanced control in PHP. 6 Develop the user interface for client side validation. 7 Develop a PHP application for MYSQL database connection. 8 Develop a PHP script with Session and Cookie. 9 Develop a PHP application for send an Email. 10 Create a PNG file with different shapes.
  • 2. Exercise: 1 Date : Create PHP script to perform any five String functions for a given strings. Aim: To create a PHP web page for perform the string function operation for a given string. Algorithm: Step 1 : Start the process Step 2: Define PHP script tags Step 3 : Use the strlen() function to display the length of a sting. Step 4: Use the str_replace() to replace the existing string values. Sept 5: Use the strtolower() for convert the given string into lower case. Sept 6: Save the file with .PHP extension Step 7: Display the output in the Browser Step 8: Stop the process
  • 3. PHP Script .php <?php echo("length:").strlen("all the best"); echo"<br/>"; echo str_word_count("all the best"); echo"<br/>"; echo strrev("all the best"); echo"<br/>"; echo strpos("all the best","best"); echo"<br/>"; echo str_replace("all","god is","all the best"); echo"<br/>"; echo strtoupper("all the best"); echo"<br/>"; echo strtolower("ALL THE BEST"); echo"<br/>"; echo ucfirst("all the best"); echo"<br/>"; echo ucwords("all the best"); echo"<br/>"; ?>
  • 4. OUTPUT: length:12 3 tseb eht lla 8 god is the best ALL THE BEST all the best All the best All The Best Result: Thus the above string function PHP script has been successfully designed and displays the output.
  • 5. Exercise: 2 Date : Develop the PHP script to perform array operation. Aim: To develop a PHP web page for perform the array based operation using built-in functions. Algorithm: Step 1: Start the process Step 2: Define PHP script tags Step 3: Use the array () function to create the array. Step 4: Use the in_array () function to find the give element is available or not in the array. Sept 5: Use the sort() function to sort elements in the array. Step 6: Use th earray_sum() function to produce the summation of array values. Sept 7: Save the file with .PHP extension Step 8: Display the output in the Browser Step Step 9: Stop the process
  • 6. PHP Script .php <?php echo"<h1><center> Array Program </center></h1>"; $roll_no = array("191ca001","191ca002","191ca003","191ca004","191ca005"); $find_rollno="191ca003"; echo "Array elements are :<br>"; echo print_r($roll_no," "); echo "<br> Find the Elements in the Array :<br>"; if(in_array($find_rollno,$roll_no)) { echo"$find_rollno found"; } else { echo"$find_rollno not found"; } $num_array1=array(1,2,3,4,5); $num_array2=array(1,2,3,4,6); sort($num_array1); echo"<br> Array1 <br>"; echo print_r($num_array1," "); echo"<br> Array count<br>"; echo count($num_array1); echo"<br> Array2 <br>"; echo print_r($num_array2," "); echo "<br>Array Difference<br>"; echo print_r(array_diff($num_array1,$num_array2)," "); echo "<br> Sum of Array=".array_sum($num_array1); ?>
  • 7. Output: Array Program Array elements are : Array ( [0] => 191ca001 [1] => 191ca002 [2] => 191ca003 [3] => 191ca004 [4] => 191ca005 ) Find the Elements in the Array : 191ca003 found Array1 Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 ) Array count 5 Array2 Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 6 ) Array Difference Array ( [4] => 5 ) Sum of Array=15 Result: Thus the above array functions PHP script has been successfully designed and displays the output.
  • 8. Exercise: 3 Date : Develop the PHP script to find the day difference between two dates. Aim: To develop a PHP web page for finding number of days between two dates using functions. Algorithm: Step 1 : Start the process Step 2: Define PHP script tags Step 3: Declare the required variable for store the dates. Step 4 : Define the dateDiffInDays () function and pass given dates. Sept 5: Return the result from the function. Sept 6: Save the file with .PHP extension Step 7: Display the output in the Browser Step 8: Stop the process
  • 9. PHP Script .php <?php function dateDiffInDays($date1,$date2) { $diff=strtotime($date2)-strtotime($date1); return abs(round($diff/86400)); } $date1="25-09-2020"; $date2="31-01-2021"; $dateDiff=dateDiffInDays($date1,$date2); printf("Difference between two dates:".$dateDiff."Days"); ?>
  • 10. Output: Difference between two dates: 128 Days Result: Thus the above user defined functions for find the number of days between two dates PHP script has been successfully designed and displays the output.
  • 11. Exercise: 4 Date : Design and develop the user interface by using generic control in PHP. Aim: To design and develop a PHP web page for prepare the student result, grade and average of a mark statement by using of generic control. Algorithm: Step 1 : Start the process Step 2: Design the user interface in a HTML file. Step 3: Use the FORM element and send user inputs to server. Step 4 : Develop the PHP script for read the user entered values. Sept 5: Use the $_REQUEST PHP variable for and store the input. Sept 6: Save the files .HTML and .PHP extension. Step 7: Display the output in the Browser Step 8: Stop the process
  • 12. HTML Design .HMTL <html> <h1><center>Student Mark Statement</center></h1> <body> Enter The Data <form action="191ca003 6.php" method="get"> ENTER REG NO : <input type="text" name="Regno"> <br> ENTER SUBJECT 1 MARK: <input type="text" name="m1"> <br> ENTER SUBJECT 2 MARK: <input type="text" name="m2"> <br> ENTER SUBJECT 3 MARK: <input type="text" name="m3"> <br> ENTER SUBJECT 4 MARK: <input type="text" name="m4"> <br> ENTER SUBJECT 5 MARK: <input type="text" name="m5"> <br> <input type="checkbox" name="tl"> :TOTAL <input type="checkbox" name="PF"> :RESULT <input type="checkbox" name="G"> :AVERAGE <br> <center><input type="submit" value="SUBMIT"></center> </form> </body> </html> Php script .PHP <html> <body> <h1><center> STUDENT RESULT </center></h1> <?php
  • 13. $regno=$_REQUEST["Regno"]; echo "REG NO :".$regno; echo "<br>"; $a=$_REQUEST["m1"]; $b=$_REQUEST["m2"]; $c=$_REQUEST["m3"]; $d=$_REQUEST["m4"]; $e=$_REQUEST["m5"]; $total=$a+$b+$c+$d+$e; if(isset($_REQUEST["tl"])) echo ("TOTAL :".$total); echo"<br>"; if(isset($_REQUEST["PF"])) { echo"RESULT :"; if($a>=35&&$b>=35&&$c>=35&&$d>=35&&$e>=35) echo " PASS "; else echo"FAIL"; } echo "<br>"; if(isset($_REQUEST["G"])) { echo ("AVERAGE : ".$total/5); echo "<br>"; } if ($total<280&&$total>=250) echo"GRADE A"; else if($total<250&&$total>=200) echo "GRADE B"; else echo " GRADE C"; ?> </body> </html>
  • 14. Output: Result: Thus the above student mark entry user interface HTML design and producing the result PHP script has been successfully designed and displays the output.
  • 15. Exercise: 5 Date : Design and develop the user interface by using advanced control in PHP. Aim: To design and develop a web page for hotel room booking user interface by using of generic control. Algorithm: Step 1 : Start the process Step 2: Design the user interface in a HTML file with advanced controls. Step 3: Use the FORM element and send user inputs to server. Step 4 : Develop the PHP script for read the user entered values. Sept 5: Use the $_REQUEST PHP variable for and store the input. Sept 6: Save the files .HTML and .PHP extension. Step 7: Display the output in the Browser Step 8: Stop the process
  • 16. HTML Design .HMTL <html> <body bgcolor="#FFFFBB"> <img src="hotel123.jpg" width="100%" height="25%"> </img> <center> <table border="1" style="font-size:30"> <tr style="color:red"> <td bgcolor="green" colspan="2"> <h1><center> ROOM BOOKING </center></h1> </td> </tr> <form method="post" action="191ca0037.php" > <tr bgcolor="yellow"> <td> ARRIVAL : </td> <td> DEPATURE : </td> </tr> <tr> <td> <input type="datetime-local" name="c1"> </td> <td> <input type="datetime-local" name="c2"> </td> </tr> <tr bgcolor="yellow"> <td> No.Of.Adults : </td> <td> No.Of.Childrens : </td> </tr> <tr> <td> <Select name="adults"> <option>1</option> <option>2</option> <option>3</option>
  • 17. <option>4</option> <option>5</option> </select> </td> <td> <Select name="children"> <option>0</option> <option>1</option> <option>2</option> <option>3</option> <option>4</option> <option>5</option> </select> </td> </tr> <tr> <td bgcolor="yellow"> No.Of.Rooms : </td> <td> <input type="text" name="room"> </td> </tr> <tr> <td bgcolor="yellow"> ROOM TYPE : </td> <td bgcolor="white"> <input type="radio" value="DELUX" name="type1"> DELUX <br> <input type="radio" value="A/C" name="type1"> A/C <br> <input type="radio" value="NON A/C" name="type1"> NON A/C </td> </tr> <tr> <td bgcolor="yellow"> Mode Of Payment </td> <td bgcolor="white"> <input type="radio" value= "CASH" name="pay"> CASH
  • 18. <input type="radio" value="CARD" name="pay"> CARD </td> </tr> <tr> <td bgcolor="yellow"> Maid ID: </td> <td> <input type="text" name="id"> </td> </tr> <tr> <td bgcolor="yellow"> Contact No : </td> <td> <input type="text" name="no"> </td> </tr> <tr><td colspan="2"> <center><input type="submit" value="BOOK MY ROOM"></center> </td> </tr> </table> </center> </body> </html> Php script .PHP <?php echo "<font color='RED'>"; echo"<center>BOOKING CONFIRMATION</center>"; echo "</font>"; echo "<br>"; echo "<br>"; echo "<font color='BLUE'>"; echo"From : "; $adate=date_create($_REQUEST["c1"]); echo date_format($adate,'d-m-Y'); echo"To:"; $ddate=date_create($_REQUEST["c2"]);
  • 19. echo date_format($ddate,'d-m-Y'); echo "<br>"; echo "<br>"; echo (" No of Rooms :".$_REQUEST["room"]); echo "<br>"; echo "<br>"; $adult=$_REQUEST["adults"]; $child=$_REQUEST["children"]; echo ($_REQUEST["type1"]." ROOM BOOKED FOR ".$adult." ADULT ".$child." CHILDREN"); echo "<br>"; echo "<br>"; echo ("YOUR PAYEMENT IS COMPLETED SUCCESSFULLY AND YOUR PAYMENT MODE IS ".$_REQUEST["pay"]); echo "<br>"; echo "<br>"; echo("THE CONFIRMATION SEND TO THE FOLLOWING MAIL ID : "); echo"<font color='RED'>"; echo($_REQUEST["id"]); echo "</font>"; echo "OR CONTACT NO : " ; echo"<font color='RED'>"; echo($_REQUEST["no"]); echo "</font>" ?>
  • 20. Output: Result: Thus the above hotel room booking user interface HTML design and producing the confirmation PHP script has been successfully designed and displays the output.
  • 21. Exercise: 6 Date : Develop the user interface for client side validation. Aim: To develop registration page with client side validation for the user entered input in PHP and Java Script. Algorithm: Step 1 : Start the process Step 2: Design the user interface. Step 3: Use the FORM element and call the formValidator() function. Step 4 : Develop Java Script for validating the user inputs. Sept 5: Define the required Java Script functions. Sept 6: Save the files .PHP extension. Step 7: Display the output in the Browser Step 8: Stop the process
  • 22. Java Script and PHP .PHP <script type='text/javascript'> function formValidator(){ var firstname=document.getElementById('firstname'); var addr=document.getElementById('addr'); var zip=document.getElementById('zip'); var username=document.getElementById('username'); var email=document.getElementById('email'); if (isAlphabet(firstname,"Please enter only letters for your name")){ if (isAlphanumeric(addr,"Numbers and Letters Only for Address")){ if (isNumeric(zip,"Please enter a vaild zip code")){ if(madeSelection(state,"Please Choose a State")){ if (emailValidator(email,"Please enter a vaild email address")){ return true; } } } } } return false; } function notEmpty(elem,helperMsg){ if(elem.value.length==0){ alert(helperMsg); elem.focus(); return false; } return true; } function isNumeric(elem,helperMsg){ var numericExpression=/^[0-9]+$/; if(elem.value.match(numericExpression)){ return true; }else{ alert(helperMsg); elem.focus(); return false; } } function isAlphabet(elem,helperMsg){ var alphaExp=/^[a-zA-Z]+$/; if(elem.value.match(alphaExp)){ return true; }else{
  • 23. alert(helperMsg); elem.focus(); return false; } } function isAlphanumeric(elem,helperMsg){ var alphaExp=/^[0-9a-zA-Z]+$/; if(elem.value.match(alphaExp)){ return true; }else{ alert(helperMsg); elem.focus(); return false; } } function madeSelection(elem,helperMsg){ if(elem.value=="please Choose"){ alert(helperMsg); elem.focus(); return false; }else{ return true; } } function emailValidator(elem,helperMsg){ var emailExp=/^[w-.+]+@[a-zA-Z0-9.-]+.[a-zA-z0-9]{2,4}$/; if(elem.value.match(emailExp)){ return true; }else{ alert(helperMsg); elem.focus(); return false; } } </script> <html> <h1><center>Registration form</center></h1> <form onsubmit='return formValidator()'action='191ca003 9.php'> <table border="2" align="center"> <tr> <td width="100"> First Name: <input type='text' id='firstname' /><br/> </td> </tr> <tr> <td>
  • 24. Address:<input type='text' id='addr'/><br/> </td> </tr> <tr> <td> zip code:<input type='text' id='zip'/><br/> </td> </tr> <tr> <td> state: <select id='state'> <option>Please Choose</option> <option>TN</option> <option>KA</option> <option>UB</option> <option>MH</option> </select><br/> </td> </tr> <tr> <td> Username :<input type='text' id='username'/><br/> </td> </tr> <tr> <td> Email :<input typr='text' id='email'/><br/> </td> </tr> <tr> <td> <input type='submit' value='Check Form' name='b1'/> </td> </tr> </table> </form> <?php if(isset($_REQUEST['b1'])) { echo "DATA IS VALID"; } ?> </html>
  • 25. Output: Result: Thus the above registration page client side data validation has been successfully designed and displays the output.
  • 26. Exercise: 7 Date : Develop a PHP application for MYSQL database connection. Aim: To develop a student data retrieval page in PHP. Algorithm: Step 1 : Start the process Step 2: Create the MYSQL database. Step 3: Create the student table in MYSQL database. Step 4: Insert the values to the student table. Sept 5: Create the connection object using mysqli(). Sept 6: Retrieve the data from the table using SELECT query. Step 7: Display the output each in retrieved row in the Browser. Step 8: Close the MYSQL connection. Step 9: Stop the process
  • 27. .PHP <?php $conn=new mysqli("192.168.24.191","student","student","191ca003db"); if(!$conn){ die('COULD NOT CONNECTED;'.mysql_error()); } echo('CONNECTED SUCCESSFULLY'); ECHO"<BR>"; ECHO"<BR>"; $a="select*from mytable3"; $result=$conn->query($a); if($result->num_rows>0){ while($row=$result->fetch_assoc()){ echo"NAME:".$row["name"]."-ROLL NO:".$row["rno"]."<br>"; } }else { echo"0 results"; } mysqli_close($conn); ?>
  • 28. OUTPUT: Result: Thus the above MYSQL database connection to the PHP application has been successfully designed and displays the output.
  • 29. Exercise: 8 Date : Develop a PHP script with Session and Cookie. Aim: To develop a College home page for display the visit count using session and cookie in PHP. Algorithm: Step 1 : Start the process Step 2: Design the college home page. Step 3: Set the cookies value using setcookie(). Step 4: Use the $_COOKIE variable for store the value. Step 5: Display the total number of visits. Step 6: Stop the process .PHP <html> <head> <title>PHP CODE TO COUNT NUMBER OF VISITORS USING COOKIES </title> </head> <h1><center>WELCOME TO DR.N.G.P ARTS AND SCIENCE COLLEGE</center></h1> <ul>COURSES <li>BCA</li> <li>BBA</li> <li>B.Sc(CS)</li> <li>B.Com</li> <li>B.Sc(IT)</li> </ul> <?php if(!isset($_COOKIE['count'])){ echo"WELCOME THIS IS THE FIRST TIME YOU VIEWED THIS PAGE"; $cookie=1; setcookie("count",$cookie); } else {
  • 30. $cookie=++$_COOKIE['count']; setcookie ("count",$cookie); echo "YOU HAVE VIEWED THIS PAGE ".$_COOKIE['count']."TIMES"; } ?> </BODY> </html> OUTPUT: Result: Thus the above college home page number of visit application using session and cookie value has been successfully designed and displays the output.
  • 31. Exercise: 9 Date : Develop a PHP application for send an Email. Aim: To develop a PHP application to send a leave email. Algorithm: Step 1 : Start the process. Step 2: Define the mail properties. Step 3: Set the cookies value using setcookie(). Step 4: Use the $_COOKIE variable for store the value. Step 5: Display the total number of visits. Step 6: Stop the process.
  • 32. .PHP <html> <head> <title>SENDING HTML EMAIL USING PHP</title> </head> <body> <?php $to="191ca003@drngpasc.ac.in"; $subject="LEAVE REQUEST"; $message=("<b>I AM REQUESTING LEAVE ON 10/05/2022"."<H1>AKASH P </h1>"); $header=("From:bca2022@gmail.comrn"."MINE-Version: 1.0rn"."Content-type: text/htmlrn"); $retval=mail ($to,$subject,$message,$header); if($retval == true) echo"MESSAGE SENT SUCCESSFULLY....."; else echo"MESSAGE COULD NOT SENT...."; ?> </BODY> </html>
  • 33. OUTPUT: Result: Thus the above leave email PHP script has been successfully designed and displays the output.
  • 34. Exercise: 10 Date : Create a PNG file with different shapes. Aim: To Create PHP web page to display the different shapes in a PNG. Algorithm: Step 1 : Start the process Step 2: Define image size using imagecreate(). Step 3: Set the color of the images using imagecolorallocate(). Step 4: Use the different image function for forming the shapes in the PNG. Step 5: Display the shapes with PNG in PHP. Step 6: Stop the process
  • 36. OUTPUT: Result: Thus the above different shapes with PNG image in PNP has been successfully designed and displays the output.