script should be in PHP/HTML
PHP File :PhpList.php
<?php
if(isset($_POST['btnSubmit']))
{
//taking first number entered by user
$firstNumber=$_POST['firstNumber'];
//taking second number entered by user
$secondNumber=$_POST['secondNumber'];
//creating a nested list
$list="<ul><li>".$firstNumber."</li><ul><li>".$secondNumber."</li></ul></ul>";
echo $list;//display list on the web page
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<!-- title for the web page -->
<title>PHP Nested List</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<!-- form tag with method and action attributes -->
<form method="post" action="PhpList.php">
<!-- label for first number -->
<label for="firstNumber">First Number</label>
<!-- textbox for firstNumber -->
<input type="text" name="firstNumber"/>
<br><br>
<!-- label for second number -->
<label for="secondNumber">Second Number</label>
<!-- textbox for secondNumber -->
<input type="text" name="secondNumber"/>
<br><br>
<!-- button to submit form -->
<input type="submit" name="btnSubmit"/>
</form>
</body>
</html>
=============================================
Output :
Screen asking two numbers :
Screen showing nested list :
Get Answers For Free
Most questions answered within 1 hours.