1.
PHP Script to Check Whether a Number is Even or Odd
<?php
$number = 15; // You can change the number
if ($number % 2 == 0) {
echo "$number is Even";
} else {
echo "$number is Odd";
}
?>
2. Faculty Registration Form for Development Program (faculty_form.php)
<!DOCTYPE html>
<html>
<head>
<title>Faculty Registration Form</title>
</head>
<body>
<h2>Faculty Development Program Registration</h2>
<form method="POST" action="faculty_submit.php">
Name: <input type="text" name="name" required><br><br>
College Name: <input type="text" name="college" required><br><br>
Mobile No: <input type="text" name="mobile" required><br><br>
Email ID: <input type="email" name="email" required><br><br>
<input type="submit" value="Register">
</form>
</body>
</html>
Faculty Registration Form Submission (faculty_submit.php)
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$name = $_POST['name'];
$college = $_POST['college'];
$mobile = $_POST['mobile'];
$email = $_POST['email'];
echo "<h2>Registration Successful!</h2>";
echo "Name: $name<br>";
echo "College: $college<br>";
echo "Mobile No: $mobile<br>";
echo "Email ID: $email<br>";
}
?>
3. Student Project Registration Form (student_form.php)
<!DOCTYPE html>
<html>
<head>
<title>Student Project Registration</title>
</head>
<body>
<h2>Project Competition Registration</h2>
<form method="POST" action="student_submit.php">
Student Name: <input type="text" name="student_name" required><br><br>
College Name: <input type="text" name="college_name" required><br><br>
Mobile No: <input type="text" name="mobile_no" required><br><br>
Email ID: <input type="email" name="email" required><br><br>
Project Title: <input type="text" name="project_title" required><br><br>
<input type="submit" value="Submit">
</form>
</body>
</html>
Student Project Submission Handling (student_submit.php)
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$student_name = $_POST['student_name'];
$college_name = $_POST['college_name'];
$mobile_no = $_POST['mobile_no'];
$email = $_POST['email'];
$project_title = $_POST['project_title'];
echo "<h2>Submission Received!</h2>";
echo "Student Name: $student_name<br>";
echo "College Name: $college_name<br>";
echo "Mobile No: $mobile_no<br>";
echo "Email ID: $email<br>";
echo "Project Title: $project_title<br>";
}
?>
4. PHP Variable Declaration Example
<?php
// Rules for declaring variables in PHP:
// 1. Start with $ sign.
// 2. Must start with a letter or underscore (_)
// 3. Cannot start with a number.
// 4. Are case-sensitive.
$studentName = "Alice";
$age = 20;
$_score = 85.5;
echo "<h2>Variable Declaration Example</h2>";
echo "Student Name: $studentName<br>";
echo "Age: $age<br>";
echo "Score: $_score<br>";
?>