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
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
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
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{
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
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>
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