Source Code:
(back to article)
Submit
Result:
Report an issue
<!DOCTYPE html> <html lang="en"> <head> <title>W3docs</title> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> <style> .gfg { font-size: 40px; font-weight: bold; color: green; } body { text-align: center; } </style> </head> <body> <?php if(!empty($_GET['submit'])) { $var = empty($_GET['option1']) ? null : $_GET['option1'] ; if($var){ echo "Option 1 submitted successfully"; } } ?> <div class="container"> <div class="gfg">W3docs</div> <h2>Form control: checkbox</h2> <p>The form below contains one checkbox.</p> <form method="get" action="/form/submit"> <div class="checkbox"> <label> <input type="checkbox" name="option1" value="Option 1" />Option 1 </label> <button name="submit" value="true">SUBMIT</button> </div> </form> </div> </body> </html>