Skip to content

Instantly share code, notes, and snippets.

@twaddington
Created March 2, 2012 22:15
Show Gist options
  • Save twaddington/1961768 to your computer and use it in GitHub Desktop.
Save twaddington/1961768 to your computer and use it in GitHub Desktop.
<!-- Server side code here -->
<?php
if ($_POST['action'] === 'logout') {
logout();
}
?>
<!-- Client side code here -->
<form action="" method="post">
<input type="hidden" name="action" value="logout" />
<p><input type="submit" /></p>
</form>
<!-- This client-side code (html) is only sent from the server to the client if the logout button was pressed -->
<?php if ($_POST['action'] === 'logout'): ?>
<p><b>You were logged out!</b></p>
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment