Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Building HTML with PHP (HTML code provided below) HTML code: <!DOCTYPE html> <ht

ID: 3810906 • Letter: B

Question

Building HTML with PHP (HTML code provided below)

HTML code:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Lab 6</title>

<!-- Bootstrap core CSS -->
<link href="bootstrap3_defaultTheme/dist/css/bootstrap.css" rel="stylesheet">

<!-- Custom styles for this template -->
<link href="css/lab6.css" rel="stylesheet">

</head>

<body>

<div class="container">
<div class="row">
<div class="col-md-3">
</div>
<div class="col-md-6">
<div id="login">
<div class="page-header">
<h2>Login</h2>
</div>
<form role="form">
<div class="form-group has-error">
<label for="exampleInputEmail1">Email address</label>
<input type="email" class="form-control" name="email" value="">
<p class="help-block">Enter an email</p>
</div>
<div class="form-group has-error">
<label for="exampleInputPassword1">Password</label>
<input type="password" class="form-control" name="password" >
<p class="help-block">Email and password not found</p>
</div>
<div class="form-group">
<label for="exampleInputFile">Server</label>
<select name="server" class="form-control">
<!--Replace the following elements with PHP-->
<option>Server 1</option>
<option>Server 2</option>
<option>Server 3</option>
<option>Server 4</option>
<option>Server 5</option>
</select>
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</div>
</div>
<div class="col-md-3">
</div>
</div>
</div> <!-- end container -->

<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="bootstrap3_defaultTheme/assets/js/jquery.js"></script>
<script src="bootstrap3_defaultTheme/dist/js/bootstrap.min.js"></script>
</body>
</html>

Login Email address Enter an email Password Email and password not found Server 1 Figure 1- Lab6.html 1. Download the provided HTML5, PHP code and CSS. Create a folder called lab6 in your htdocs directory. Unzip and place the provided files in your lab6 directory. Ensure that you can view the page by going to htt Examine the lab6.html file to understand the structure of the code. Make a copy of this file and called it lab6.php. This is the file you will be working with 2. Use the PHP include() function to include the file lab6-data.php in lab6.php. This file sets the values of two variables $email and $password. Don't forget to put your PHP code with the PHP tags. 3. Using a for loop in PHP, replace the koption elements as noted in the file 4. Modify the code so that the values of the email input element and password input element are provided by the variables $email and $password. 5. Use an if-else to display an error message under the input fields for username (as shown in Figure 1) if the $email variable is left blank (by default, the values of the variables in lab6-data.php are empty). You can check to see if a variable is empty in PHP using the empty() function where you pass is the variable you want to check as a parameter and it will return true or false. Add the has-error CSS class to the appropriate

Explanation / Answer

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Lab 6</title>
<!-- Bootstrap core CSS -->
<link href="bootstrap3_defaultTheme/dist/css/bootstrap.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="css/lab6.css" rel="stylesheet">
</head>
<body>
<?php
$server = array('Server 1','Server 2','Server 3','Server 4','Server 5');
$emailErr ='';
$pwdErr ='';
include("lab6-data.php");
if(isset($_POST['SubmitButton'])){ //check if form was submitted

if (empty($_POST["email"])) {
$emailErr = "Enter an email";
} else {
$Email = $_POST["email"];
}
if (empty($_POST["password"])) {
$pwdErr = "Email and password not found";
} else {
$Password = $_POST["password"];
}
}
include("lab6-data.php");
?>
<div class="container">
<div class="row">
<div class="col-md-3">
</div>
<div class="col-md-6">
<div id="login">
<div class="page-header">
<h2>Login</h2>
</div>
<form role="form" action="" method="post">
<div class="form-group has-error">
  
<label for="exampleInputEmail1">Email address</label>
<input type="email" class="form-control" name="email" value="">
<p class="help-block"><?php echo $emailErr;?></p>
</div>
<div class="form-group has-error">
<label for="exampleInputPassword1">Password</label>
<input type="password" class="form-control" name="password" >
<p class="help-block"><?php echo $pwdErr; ?></p>
</div>
<div class="form-group">
<label for="exampleInputFile">Server</label>
<select name="server" class="form-control">
<?php
                   foreach($server as $key => $value):
                   echo '<option value="'.$key.'">'.$value.'</option>'; //close your tags!!
                   endforeach;
                   ?>
</select>


</div>
<button type="submit" class="btn btn-primary" name="SubmitButton">Submit</button>
</form>
</div>
</div>
<div class="col-md-3">
</div>
</div>
</div> <!-- end container -->
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="bootstrap3_defaultTheme/assets/js/jquery.js"></script>
<script src="bootstrap3_defaultTheme/dist/js/bootstrap.min.js"></script>
</body>
</html>

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at drjack9650@gmail.com
Chat Now And Get Quote