MODULE NO 4 DATE:07/01/2025
MODULE-04
a) Develop a PHP program to illustrate the PHP Form handling
by using GET and POST methods.
USING GET METHOD:
login.html:
<html>
<head>
<title>Simple Login Form
</title>
</head>
<body align="center" bgcolor="pink" text="red">
<form name="fn" method="get" action="getex.php">
<h2>Login Form</h2>
UserName:<input type="text" name="un"/><br><br>
Password:<input type="password" name="pw"/><br><br>
<button type="submit">Submit</button>
<button type="reset">Reset</button>
</form>
</body>
</html>
getex.php
<?php
$u=$_GET["un"];
$p=$_GET["pw"];
echo "The User name is: ".$u;
echo "The Password is: ".$p;
?>
19
LAKIREDDY BALI REDDY COLLEGE OF ENGINEERING 23765A0516
MODULE NO 4 DATE:07/01/2025
Output:
20
LAKIREDDY BALI REDDY COLLEGE OF ENGINEERING 23765A0516
MODULE NO 4 DATE:07/01/2025
USING POST METHOD:
login.html
<html>
<head>
<title>Simple Login Form
</title>
</head>
<body align="center" bgcolor="pink" text="red">
<form name="fn" method="post" action="getex.php">
<h2>Login Form</h2>
UserName:<input type="text" name="un"/><br><br>
Password:<input type="password" name="pw"/><br><br>
<button type="submit">Submit</button>
<button type="reset">Reset</button>
</form>
</body>
</html>
getex.php
<?php
$u=$_POST["un"];
$p=$_POST["pw"];
echo "The User name is: ".$u;
echo "The Password is: ".$p;
?>
21
LAKIREDDY BALI REDDY COLLEGE OF ENGINEERING 23765A0516
MODULE NO 4 DATE:07/01/2025
Output:
22
LAKIREDDY BALI REDDY COLLEGE OF ENGINEERING 23765A0516
MODULE NO 4 DATE:07/01/2025
USING REQUEST METHOD:
login.html
<html>
<head>
<title>Simple Login Form
</title>
</head>
<body align="center" bgcolor="pink" text="red">
<form name="fn" method="request" action="getex.php">
<h2>Login Form</h2>
UserName:<input type="text" name="un"/><br><br>
Password:<input type="password" name="pw"/><br><br>
<button type="submit">Submit</button>
<button type="reset">Reset</button>
</form>
</body>
</html>
getex.php
<?php
$u=$_REQUEST["un"];
$p=$_REQUEST["pw"];
echo "The User name is: ".$u;
echo "The Password is: ".$p;
?>
23
LAKIREDDY BALI REDDY COLLEGE OF ENGINEERING 23765A0516
MODULE NO 4 DATE:07/01/2025
Output:
24
LAKIREDDY BALI REDDY COLLEGE OF ENGINEERING 23765A0516
MODULE NO 4 DATE:07/01/2025
b) Develop a PHP program to demonstrate the importance of
include() and require() functions.
4b.html:
<html>
<body>
<a href="https://www.google.com/">Google</a>
<a href="https://www.instagram.com/">Instagram</a>
<a href="https://www.youtube.com/">Youtube</a>
</body>
</html>
4b.php:
<?php
Include “4b.html”;
echo”</br>”;
include “4b.html”;
echo”</br>’;
require ”4b.html”;
echo “</br>”;
?>
25
LAKIREDDY BALI REDDY COLLEGE OF ENGINEERING 23765A0516
MODULE NO 4 DATE:07/01/2025
Output:
26
LAKIREDDY BALI REDDY COLLEGE OF ENGINEERING 23765A0516
MODULE NO 4 DATE:07/01/2025
27
LAKIREDDY BALI REDDY COLLEGE OF ENGINEERING 23765A0516