Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
13 views5 pages

WBP22202A0023PR11

Uploaded by

guyn9074
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views5 pages

WBP22202A0023PR11

Uploaded by

guyn9074
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

IF6IA WBP

DEPARTMENT OF INFORMATION TECHNOLOGY

Subject: Web based Application Development Subject Code: 22619


using PHP
Semester: 6th Course: IF6IA
Laboratory No: L001 Name of Teacher: Chetashri Bhusari
Name of Student: Prajwal Patekar Roll ID: 2220A0023

Experiment No: 11
Title of Experiment Design a web page using following form controls:
a. ListBox b. Hidden Field c. ComboBox

☆ Practical Related Questions


1. Write a use and syntax of following controls in PHP.
a. ListBox b. Hidden Field c. ComboBox
Ans:
List Box
Use: A list box is used to display a list of options from which the user can select one or more
options. It is often used for selecting multiple items or viewing long lists.

Syntax:
<label for="fruits">Select Your Favorite Fruits:</label>
<select id="fruits" name="fruits" size="4" multiple>
<option value="apple">Apple</option>
<option value="banana">Banana</option>
<option value="cherry">Cherry</option>
<option value="orange">Orange</option>
</select>

Hidden Field
Use: A hidden field is used to store data that the user does not need to interact with. It is often
used to store session information, form data, or any other value that needs to be passed without
showing to the user.

Syntax:
<input type="hidden" id="userID" name="userID" value="12345">

Combo Box (Drop-down List)


Use: A combo box (also known as a drop-down list) allows users to select a value from a
predefined list of options. It is useful when there is limited space or when the list of options is
long.

Syntax:

22202A0023 Prajwal Patekar


IF6IA WBP

<label for="country">Select Country:</label>


<select id="country" name="country">
<option value="usa">USA</option>
<option value="india">India</option>
<option value="uk">UK</option>
<option value="aus">Australia</option>
</select>

☆ Exercise

1. Write a program to design a form using list box, combo box.


Ans:
Colors.html
<html>
<head>
<title>List Box and Combo Box</title>
</head>
<body>
<form action="EXP11.php" method="post">
<select name="colours[]" size="5">
<option value="red">RED</option>
<option value="green">GREEN</option>
<option value="blue">BLUE</option>
<option value="yellow">YELLOW</option>
<option value="teal">TEAL</option>
<option value="pink">PINK</option>
</select><br> <br> <br> <br>

<select name="foods[]">
<option value="Mango">Mango</option>
<option value="Banana">Banana</option>
<option value="Watermelon">Watermelon</option>
<option value="Grapes">Grapes</option>

22202A0023 Prajwal Patekar


IF6IA WBP

</select><br>
<input type="submit" name="submit" value="Submit"/>
</form>
</body>
</html>

Colors.php
<html>
<body>
<?php
$c= $_POST['colours'];
if(isset($c))
{
echo 'You have chosen ';
foreach($c as $key => $value)
{
echo $value;
}
}
else
{
echo "You haven't selected any colour";
}
echo "<br> <br> <br> <br>";
$d= $_POST['foods'];
if(isset($d))
{
echo 'You have chosen ';
foreach($d as $key => $value)
{

22202A0023 Prajwal Patekar


IF6IA WBP

echo $value;
}
}
else
{
echo "You haven't selected any fruit";
}
?>
</body>
</html>

Output:

22202A0023 Prajwal Patekar


IF6IA WBP

22202A0023 Prajwal Patekar

You might also like