〜PHPの学習2/12 ラジオボタン〜
<!DOCTYPE html> <html lang="ja"> <head> <meta charset="UTF-8"> <title>phpの勉強 radio_buttonの値を取得する</title> </head> <body> <?php print '入力内容:'.@$_POST['text1']; ?> <form method="post" action="<?php print $_SERVER['PHP_SELF']; ?>"> <dl> <dd> <input type="radio" name="gender" value="男性" checked>男性 <input type="radio" name="gender" value="女性">女性 </dd> </dl> <input type="submit" value="送信"> </form> <?php print('性別:'.htmlspecialchars($_POST['gender'],ENT_NOQUOTES)); ?> </body> </html>