Skip to content

Instantly share code, notes, and snippets.

@gitmasta
Created July 3, 2013 09:08
Show Gist options
  • Save gitmasta/5916540 to your computer and use it in GitHub Desktop.
Save gitmasta/5916540 to your computer and use it in GitHub Desktop.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Checbox</title>
</head>
<body>
<?php
$check=array();
if(isset($_POST['check']) and is_array($_POST['check']))
$check=$_POST['check'];
?>
<form action="" method="post">
<input type="checkbox" name="check[]" value="1" id="" <?php if(in_array(1,$check)) echo 'checked="checked"'?>>
<input type="checkbox" name="check[]" value="2" id="" <?php if(in_array(2,$check)) echo 'checked="checked"'?>>
<input type="submit" value="envoyer" name="submit" id="">
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment