テキストボックスを使う

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>テキストボックスを使いたい</title>
</head>
<body>
<?php
echo '<p>結果:</p>';
echo '<p>テキストボックス(初期値を指定)</p>';
echo h(@$_POST['example1']);
echo '<p>テキストボックス(size属性に10を指定)</p>';
echo h(@$_POST['example2']);
echo '<p>テキストボックス(size属性に50、maxlength属性に30を指定)</p>';
echo h(@$_POST['example3']);
echo '<p>テキストボックス(disabledでボックスを無効化する)</p>';
echo h(@$_POST['example4']);
echo '<p>テキストボックス(readonlyで書き換えを禁止する)</p>';
echo h(@$_POST['example5']);
echo '<hr />';

function h($string) { // HTMLでのエスケープ処理をする関数
  return htmlspecialchars($string, ENT_QUOTES);
}
?>
<form method="post" action="">
<p>テキストボックス(初期値を指定)</p>
<input type="text" name="example1" value="サンプル" />
<p>テキストボックス(size属性に10を指定)</p>
<input type="text" name="example2" size="10" value="" />
<p>テキストボックス(size属性に50、maxlength属性に30を指定)</p>
<input type="text" name="example3" size="50" maxlength="30" value="" />
<p>テキストボックス(disabledでボックスを無効化する)</p>
<input type="text" name="example4" value="サンプル" disabled="disabled" />
<p>テキストボックス(readonlyで書き換えを禁止する)</p>
<input type="text" name="example5" value="サンプル" readonly="readonly" />
<br />
<input type="submit" value="送信する" />
</form>
</body>
</html>