Lab #4
4. Write two different PHP scripts to demonstrate passing variables through Hidden Variables
index.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Pass variable URL</title>
<style>
.form-input {
margin: 10px 0;
}
</style>
</head>
<body>
<form action="result.php" method="post">
<div class="form-input">
<input type="text" name="name" placeholder="Enter full name">
</div>
<div class="form-input">
<input type="number" name="age" min="10" placeholder="Enter age">
</div>
<div class="form-input">
<button type="submit">Submit</button>
</div>
</form>
</body>
</html>
result.php
<?php
echo "Name: ".$_POST['name'].'<br/>';
echo "Age: ".$_POST['age'].'<br/>';
?>
Output
index.php page
0 Comments
Post a Comment