条件分岐 3−2
<?php
error_reporting(1);
?><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="ja"><head>
<meta http-equiv="Content-type" content="text/html; charset=EUC-JP">
<meta http-equiv="Content-Style-Type" content="text/css">
<link rel="stylesheet" href="./style.css">
<title>ザ・ビートルズ!</title>
<style type="text/css">
.john{
background-image:url(img/john.gif);
background-repeat:no-repeat;
background-position:left 5px 10px;
border-style:solid;
border-width:0px;
width:500px;
height:175;
padding:10px;
line-height:16px;
margin:10px 10px 10px 10px;
}
.paul{
background-image:url(img/paul.gif);
background-repeat:no-repeat;
background-position:left 5px 10px;
border-style:solid;
border-width:0px;
width:500px;
height:175;
padding:10px;
line-height:16px;
margin:10px 10px 10px 10px;
}
.george{
background-image:url(img/george.gif);
background-repeat:no-repeat;
background-position:left 5px 10px;
border-style:solid;
border-width:0px;
width:500px;
height:175;
padding:10px;
line-height:16px;
margin:10px 10px 10px 10px;
}
.ringo{
background-image:url(img/ringo.gif);
background-repeat:no-repeat;
background-position:left 5px 10px;
border-style:solid;
border-width:0px;
width:500px;
height:175;
padding:10px;
line-height:16px;
margin:10px 10px 10px 10px;
}
.bun1{
border-style:solid;
border-width:0px;
width:440px;
padding:0px;
margin-left:110px;
border-width:0px;
}
.together{
border-style:solid;
border-width:0px;
width:500px;
height:175;
padding:10px;
line-height:16px;
margin:10px 10px 10px 10px;
}
h1{
width:558;
text-align:center;
}
h3{
width:380;
}
</style></head>
<body><div class="file2">
<h1>The Beatles!</h1>
<div style="margin-left:0">
<form method="post" action="03_02_if.php">
<input type="submit" value="John Lennon" name="beatle">
<input type="submit" value="Paul McCartney" name="beatle">
<input type="submit" value="George Harrison" name="beatle">
<input type="submit" value="Ringo Starr" name="beatle">
<input type="submit" value="Together" name="beatle">
</form></div>
<?php $beatle = $_POST['beatle'];if ($beatle == "John Lennon"): ?><div class="john"><div class="bun1"><h3>JOHN LENNON</h3>
<ol><li>Real Name:John Winston Lennon</li>
<li>Born:October 9th 1940 in Liverpool</li>
<li>Guitar:Rickenbacker325,Gibson J-160E</li>
<li>Shoot to death on December 8th 1980 in New York</li></ol>
</div></div>
<?php endif; ?><?php $beatle = $_POST['beatle'];if ($beatle == "Paul McCartney"): ?><div class="paul"><div class="bun1"><h3>PAUL MCCARTONEY</h3>
<ol><li>Real Name:James Paul McCartney</li>
<li>Born:June 18th 1942 in Liverpool</li>
<li>Bass Guitar:Hofner500-1,Rickenbacker4001S</li>
<li>Playing an active part in the world</li></ol>
</div></div>
<?php endif; ?><?php $beatle = $_POST['beatle'];if ($beatle == "George Harrison"): ?><div class="george"><div class="bun1"><h3>GEORGE HARRISON</h3>
<ol><li>Real Name:George Harrison</li>
<li>Born:January 24th 1943 in Liverpool</li>
<li>Guitar:Gretch Country Gentleman,Rickenbacker 360-12</li>
<li>Died of cancer on November 29th 2001 in LosAngels</li></ol>
</div></div>
<?php endif; ?><?php $beatle = $_POST['beatle'];if ($beatle == "Ringo Starr"): ?><div class="ringo"><div class="bun1"><h3>Ringo Starr</h3>
<ol><li>Real Name:Richerd Starkey</li>
<li>Born:July 7th 1940 in Liverpool</li>
<li>Drums:Ludwig Downbeat,Ludwing Super classic</li>
<li>Playing an active part in the world</li></ol>
</div></div>
<?php endif; ?><?php $beatle = $_POST['beatle'];if ($beatle == "Together"): ?><div class="together">
<img src="img/paul.gif"><img src="img/george.gif">
<img src="img/ringo.gif"><img src="img/john.gif"></div>
<?php endif; ?></div></body></html>