Module 4
Module 4
a)Develop a PHP program to illustrate the PHP Form handling by using GET and POST
methods.
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<h1>Login Page</h1>
<label for="username">Username:</label>
<br>
<br><br>
<label for="password">Password:</label>
<br>
<br><br>
<button type="reset">Reset</button>
<button type="submit">Login</button>
</form>
</body>
</html>
get.php:
<?php
$u=$_GET["username"];
$p=$_GET["password"];
?>
OUTPUT:
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<h1>Login Page</h1>
<label for="username">Username:</label>
<br>
<br><br>
<label for="password">Password:</label>
<br>
<br><br>
<button type="reset">Reset</button>
<button type="submit">Login</button
</form>
</body>
</html>
post.php:
<?php
$u=$_POST["username"];
$p=$_POST["password"];
?>
OUTPUT:
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<h1>Login Page</h1>
<label for="username">Username:</label>
<br>
<br><br>
<label for="password">Password:</label>
<br>
<br><br>
<button type="reset">Reset</button>
<button type="submit">Login</button>
</form>
</body>
</html>
Request.php:
<?php
$u=$_REQUEST["username"];
$p=$_REQUEST["password"];
?>
OUTPUT:
Urls.html:
<html>
<body>
<a href="https://openai.com/index/chatgpt/">CHATGPT</a>
<a href="https://www.flipkart.com/">FLIPKART</a>
</body>
</html>
Include.php:
<?php
include "urls.html";
echo "</br>";
require "urls.html";
echo "</br>";
include "urls.html";
?>
OUTPUT:
<?php
include "urlss.html";
echo "</br>";
echo "HI";
require "urlss.html";
echo "</br>";
include "urlss.html";
?>
OUTPUT:
Details.php:
<?php
$regno="F8";
$name="Kollipara Akhil";
$Dob="18-06-2004";
?>
Retrive Details.php:
<?php
include "details.php";
echo "</br>";
echo "</br>";
echo "Branch:".$branch;
echo "</br>";
?>
OUTPUT: