Server Error, basic PHP error?

Hi guys I have a simple PHP page below are the codes,


<!DOCTYPE html>
<head>
	<title></title>
</head>

<body>
	<?php
		error_reporting(E_ALL);
	
		$username = "admin";
		$password = "pass";
	?>
	

	<?php
		if(isset($_POST['sb'])) {
			if($_POST['username'] == $username && $_POST['password'] == $password)
			{
				echo "Download here";
				echo "<button>download</button>";
			}
		}
		else
		}
	?>
			<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
			username : <input type="text" name="username"><br/>
			password : <input type="password" name="password"><br/>
					   <input type='submit' name='sb' id='sb' value='login'>
			</form>
	<?php
		{
	?>
</body>		
</html>

The problem is the page keep saying “SERVER ERROR”
I check the CPanel error_log and the error_log filename in the root folder.
I can’t see the error.

Can you help me spot the not above.

Thanks in advance.

The curly brace after the ELSE must be the other one. You have }, but it must be { (about half way down the code)

@ScallioXTX ;

Thank you.

Not related to your problem, but a good tip: When you have PHP code blocks intermixed with HTML and spanning across multiple blocks, you can use an alternate syntax instead of braces.


if($something==true):
   echo "hello";
else:
   echo "goodbye";
endif;

This sometimes helps keep track of when you open and close if, for, while, and foreach control structures, especially when they’re nested a few levels deep.

http://php.net/manual/en/control-structures.alternative-syntax.php