CCode for Artists - Miles DeCoster








When submitted the form reloads the same page and checks the user entered password against the value in the PHP file. It gives the message variable a value based on whether the password matches and passes the text into the "message" html element. As you can see in the code below, the password is “swordfish”.

<?php
if (isset($_POST['submitted'])) { // Handle the form.

if ($_POST['password']=="swordfish") {
	$message = "Thank you for logging in.";
  } else {
	$message="Invalid password";
	}
 } // end of submitted
?>

<script>
myMessage="<?php echo $message; ?>";
$(document).ready(function() {
	$('#message').html(myMessage);
});
</script>