フォームの練習3 チェックボタン,ラジオボタン
チェックボタン
<!DOCTYPE html> <html lang="ja"> <head> <meta charset="UTF-8"> <title>チェックボックス</title> </head> <body> <h1>チェックボックス</h1> <form action="request.php" method="post"> <p>スマートフォン <label><input type="checkbox" name="mobile" value="1" checked>iPhone</label> <label><input type="checkbox" name="mobile" value="2" checked>Android</label> <label><input type="checkbox" name="mobile" value="3" checked>その他</label> </p> <p><input type="submit" value="送信"></p> </form> </body> </html>
<!DOCTYPE html> <html lang="ja"> <head> <meta charset="UTF-8"> <title>ラジオボタン</title> </head> <body> <h1>ラジオボタン</h1> <form action="request.php" method="post"> <p>性別: <label><input type="radio" name="sex" value="male" checked>男性</label> <label><input type="radio" name="sex" value="female" checked>女性</label> </p> <p><input type="submit" value="送信"></p> </form> </body> </html>