用單選出拳

<?php	
//最上方
	include("functions.php");
	if ( isset($_REQUEST['hand']) ) {
		$hand = $_REQUEST['hand'];
		if ($hand == "s") $myfig="scissors.png";
		if ($hand == "r") $myfig="rock.png";
		if ($hand == "p") $myfig="paper.png";
		$mymsg = <<
		<img src="images/$myfig" />
	</div>
eof;
	}
	
//style內
	<style>
		.myhand{
			width:300px;
			height:300px;
			border:1px solid gray;
		}
		.myhand img{
			width:100%;
		}
	</style>

//form內
	<label><input type="radio" name="hand" value="s" 
	<?php if ($hand == "s") echo "checked='checked'"; ?>/>剪刀</label>
	<label><input type="radio" name="hand" value="r"
	<?php if ($hand == "r") echo "checked='checked'"; ?>	/>石頭</label>
	<label><input type="radio" name="hand" value="p" 
	<?php if ($hand == "p") echo "checked='checked'"; ?>/>布</label>
	<input type="submit" value="出拳" />

//最下方
	<?php if (isset($mymsg)) echo $mymsg; ?>
?>