Lab Manual
Lab Manual
1
CO1- Apply concept of html, css for web page development.
Experiment-1
Aim:
Solution:
<!DOCTYPE html>
<html>
<body>
<?php
?>
</body>
</html>
<?php
$t = date("H");
?>
Experiment-1.2
CO1-Apply concept of html, css for web page development.
Experiment-2
Objective: To utilize the basic concepts of PHP in order to ensure dynamic webpage creation
<?php
$x = 1;
while($x <= 5) {
$x++;
?>
<?php
$Pass_Mark=35;
$Student_Mark=70;
if ($Student_Mark>= $Pass_Mark){
?>
<!DOCTYPE html>
<html>
<body>
<?php
echo count($cars);
?>
</body>
</html>
Experiment-1.3
CO2-Analyse the function of php as a dynamic webpage creating tool.
Objective: To utilize the basic concepts of PHP in order to ensure dynamic webpage creation
Create a script using a for loop to add all the integers between 0 and 30 and display the total.
Solution:-
<?php
$sum = 0;
for($x=1; $x<=30; $x++)
{
$sum +=$x;
}
echo "The sum of the numbers 0 to 30 is $sum"."\n";
?>
Experiment_1.4
CO2-Analyse the function of php as a dynamic webpage creating tool.
Experiment-4
Objective: simple function which will display a simple "Merry Christmas and a Very Happy New Year"
message. This script can actually be very useful when you have to send festive emails to every friend
of yours and you have to write the same message in all of them.
Solution:
<?php
// defining the function
function greetings()0
{
echo "Merry Christmas and a Very Happy New Year";
}
// next line
echo "<br/>";
?>
TextBooks
Experiment_2.1
Experiment-5
Objective:- PHP class called 'Student' with properties like 'name', 'age', and 'grade'.
Implement a method to display student information. The "Student" class has three public
properties: $name, $age, and $grade, which represent the student's name, age, and grade.The
"displayInfo()" method is implemented to display student information by echoing the values of
the properties.
(a) Creating application using PHP in which implement properties
<?php
class Student {
public $name;
public $age;
public $grade;
$student->age = 16;
$student->grade = 10;
$student->displayInfo();
?>
b) Creating application using PHP in which implement File Uploading & Downloading <!DOCTYPE html>
<?php
if(isset($_FILES['image'])){
$errors= array();
$file_name = $_FILES['image']['name'];
$file_size =$_FILES['image']['size'];
$file_tmp =$_FILES['image']['tmp_name'];
$file_type=$_FILES['image']['type'];
$file_ext=strtolower(end(explode('.',$_FILES['image']['name'])));
$extensions= array("jpeg","jpg","png");
if(in_array($file_ext,$extensions)=== false){
}
if($file_size > 2097152){
if(empty($errors)==true){
move_uploaded_file($file_tmp,"images/".$file_name);
echo "Success";
}else{
print_r($errors);
?>
<html>
<body>
<input type="submit"/>
</form>
</body>
</html>
Experiment6
Creating simple table with constraints
<?php
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "myDB";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$conn->close();
?>