Here's how to do it by submitting the form to the same page.
Take out the onclick, that's a javascript event and has nothing to do with PHP.
Set the form's action attribute to be the same page... $_SERVER['PHP_SELF']
The variable $pass won't be in the checkpass() function's namespace if registered globals is off (which it should be off), so you'll access it using $_POST['pass'].
And remember, call the function.
Here's your script modified. Maybe this will jog some memory.
<form action="$_SERVER['PHP_SELF']" method="post">
<table align="left" border="0" cellspacing="0" cellpadding="3">
<tr><td>Password:</td><td><input type="text" name="pass" maxlength="30"></td></tr>
<tr><td colspan="2" align="left"><input type="submit" name="sublogin" value="Login"></td></tr>
</table>
</form>
<br /><br />
<?php
if(isset($_POST['pass'])){
checkpass();
}
function checkpass(){
echo "lol";
if($_POST['pass'] == ""){
echo "<br /><br /><br />Correct!";
} else {
echo "<br /><br /><br />Try Again!";
}
}
?>