This question already has an answer here:
When I try to load the webpage in explorer In get this error. Not sure why this is occurring, gone through my code and everything looks fine.
This is my code for my index page:
<!DOCTYPE HTML>
<html>
<head>
<title>PHP FORM - 08246 ACW PART 2</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://ift.tt/1RLAc2h">
<style>
.error {color: #FF0000;}
</style>
</head>
<body>
<ul class="w3-navbar w3-black w3">
<li><a href="index.php">Home</a></li>
<li><a href="changelocationtostaffmember.php">Change location to staff member</a></li>
<li><a href="currentlocationofallstaff.php">Current location of all staff</a></li>
<li><a href="editpersonaldetailsofstaffmember.php">Edit personal details of staff member</a></li>
<li><a href="listalllocationsandshowlistofpeopleinselectedlocation.php">List all locations and show list of people in selected location</a></li>
<li><a href="staffmemberandlistlocationsforlast24hours.php">Staff member and list locations for last24 hours</a></li>
</ul>
<div class="w3-container">
<?php
// defining the variables and setting them to empty values
$first_nameErr = $SurnameErr = $usernameErr = $passwordErr = $previous_LocationErr = $current_LocationErr = $dateErr = $timeErr = $dErr = $tErr = "";
$first_name = $Surname = $username = $password = $previous_Location = $current_Location = $date = $time = $dErr = $tErr = "";
//----validation----
//first name
if($_SERVER["REQUEST_METHOD"] == "POST"){
if(empty($_POST["first_name"])){
$first_nameErr = "First Name is required";
}else{
$first_name = test_input($_POST["first_name"]);
//validation checking
if(!preg_match("/^[a-zA-Z ]*$/",$first_name)){
$first_nameErr = "Please enter only letter and white space";
}
}
//surname
if($_SERVER["REQUEST_METHOD"]=="POST"){
if(empty($_POST["Surname"])){
$SurnameErr="Surname is required";
}else{
$Surname=test_input($_POST["Surname"]);
//validation checking
if(preg_match("/^[a-zA-Z ]*$/",$Surname)){
$SurnameErr = " Please enter only letters and white spaces";
}
}
//date and time
date_default_timezone_set('UTC');
$d = str_replace('/',',', '03/05/2016');
$t = str_replace(':',',', '13:38');
$date = $t.',0,'.$d;
$fulldate = explode(',',$date);
echo '<br>';
$h = $fulldate[0];
$i = $fulldate[1];
$s = $fulldate[2];
$m = $fulldate[3];
$d = $fulldate[4];
$y = $fulldate[5];
echo date("h-i-s-M-d-Y",mktime($h,$i,$s,$m,$d,$y))."<br>";
echo strtotime ("03/05/2016 13:38");
function test_input($data){
$data=trim($data);
$data=stripslashes($data);
$data=hmtlspecialchars($data);
return $data;
}
?>
<p><span class="error">* are required field.</span></p>
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
First Name: <input type="text" name="first_name"><br>
<span class="error">* <?php echo $First_nameErr;?></span>
<br>
Surname: <input type="text" name="Surname"><br>
<span class="error">* <?php echo $SurnameErr;?></span>
<br>
Username: <input type="text" name="username"><br>
<span class="error">* <?php echo $username;?></span>
<br>
Current Location: <input type="text" name="current_Location"><br>
<span class="error">* <?php echo $current_Location;?></span>
<br>
Date: <input type="text" name="date"><br>
<span class="error">* <?php echo $date;?></span>
<br>
Time: <input type="text" name="time"><br>
<span class="error">* <?php echo $time;?></span>
<br>
<input type="submit" name="submit" value="Submit">
</form>
</div>
</body>
</html>
I am new PHP and still learning. Any help or guidance of how/ why this is happening would be greatly appreciated.
Thank You.
Aucun commentaire:
Enregistrer un commentaire