Skip to content

Instantly share code, notes, and snippets.

@amitayh
Created April 5, 2011 16:11
Show Gist options
  • Save amitayh/903910 to your computer and use it in GitHub Desktop.
Save amitayh/903910 to your computer and use it in GitHub Desktop.
<?php
$value = 0;
if ($_POST) {
$value = (int) $_POST['value'];
if (isset($_POST['inc'])) {
$value++;
} elseif (isset($_POST['dec'])) {
$value--;
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Counter</title>
</head>
<body>
<form action="" method="post">
<input type="submit" name="dec" value="-" />
<input type="text" name="value" readonly="readonly" value="<?php echo $value; ?>" size="2" />
<input type="submit" name="inc" value="+" />
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment