<?php
if ($_POST['submit'] == 'Log in'){
	/*$bool = setcookie("Username", $_POST['username'], time() + (30 * (365 * 86400)));
	if ($bool) echo 'Cookie Set';*/
	echo '<script>localStorage.setItem("Username","'.$_POST["username"].'");</script>';
}

?>
<form action = "cookiedemo.php" method="post">
/<!--Username: <input type="text" name="username" value="<?php echo $_COOKIE['Username'];?>"><br>-->
<input type="text" name="username" id="username" value=""><br>

Password: <input type="password" name="password"></br>
<input type="submit" name="submit" value="Log in"/>
</form>
<script>
	document.getElementById("username").value = localStorage.getItem('Username');
	

</script>