Lab #4

3. Write two different PHP scripts to demonstrate passing variables through a URL


<!DOCTYPE html>
<html lang="en">

<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>
.form-input {
margin: 10px 0;

<form action="result.php" method="get">
<div class="form-input">
<input type="text" name="name" placeholder="Enter full name">

<div class="form-input">
<input type="number" name="age" min="10" placeholder="Enter age">

<div class="form-input">
<button type="submit">Submit</button>



echo "Name: ".$_GET['name'].'<br/>';
echo "Age: ".$_GET['age'].'<br/>';


index.php page

After clicking submit button and you can notice the variable on the URL. 

Happy Coding :)