<?php print '<?xml version="1.0" encoding="UTF-8"?>'; print '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"'; print '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'; print '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">'; print "<head>"; print '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">'; print '<meta http-equiv="Content-Language" content="ja">'; print "<title>"; print "テストページ"; print "</title>"; print "</head>"; print "<body bgcolor='skyblue'>"; print "わーい"; print "</body>"; print "</html>"; ?>
<?php $mozi=<<<eot <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Language" content="ja"> <title> テストページ </title> </head> <body bgcolor='skyblue'> わーい </body> </html> eot; print $mozi; ?>
<?php $str=<<<eot こんにちは こんばんは eot; print $str; ?>
こんにちはこんばんは
<?php $str=<<<eot こんにちは こんばんは eot; print nl2br($str); ?>
こんにちは
こんばんは
okuri.html
テキストボックスに入力した文字列を、送信ボタンで送信する。
uke.php
受信したデータをそのまま表示する。
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Language" content="ja"> <title> okuri.html </title> </head> <body bgcolor='skyblue'> <form action="uke.php" method="post"> <input type="text" name="a"> <br> <input type="submit" value="送信"> </form> </body> </html>
<?php print $_POST["a"]; ?>
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Language" content="ja"> <title> radio.php </title> </head> <body bgcolor='skyblue'> <form action="radio_uke.php" method="post"> あなたの年齢を選択して、送信ボタンをクリックしてください。<br> <?php $i=1; $c=1; while($i<=100){ print "<input type='radio' name='r' value='$i'>$i "; if($c==100){ print "<br>"; $c=0; } $i++; $c++; } ?> <input type="submit" value="送信"> </form> </body> </html>
<?php print "あなたの年齢は".$_POST["r"]."歳です。"; ?>