WBP Exp 11

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Oaish Qazi 1|Page

Practical No 11:

Q. Write a Program to add hidden field, listbox, and combobox on webpage and display the values
entered and selected on the next page.
CODE:
index.php:
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$listBox = $_POST['listBox'];
$comboBox = $_POST['comboBox'];

echo "<h2>Entered Data:</h2>";


echo "<p>Listbox Selected: $listBox</p>";
echo "<p>Combobox Selected: $comboBox</p>";}

index.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Form Page</title>
</head>
<body>
<h2>Form Page</h2>
<form action="index.php" method="post">
<input type="hidden" name="hiddenField" value="hiddenValue">

<label for="listBox">Listbox:</label>
<select id="listBox" name="listBox">
<option value="Java">Java</option>
<option value="C++">C++</option>
<option value="Python">Python</option>
</select><br><br>

<label for="comboBox">Combobox:</label>
<select id="comboBox" name="comboBox">
<option value="Frontend">Frontend</option>
<option value="Backend">Backend</option>
<option value="Full-Stack">Full-Stack</option>
</select><br><br>

<button type="submit">Submit</button>
</form>
</body>
</html>
Oaish Qazi 2|Page
OUTPUT:

You might also like