<php if ( isset( $_REQUEST['myh']) ) { $myh = $_REQUEST['myh']; $myw = $_REQUEST['myw']; $mybmi = $myw / $myh / $myh * 10000 ; $mymsg = <<<eof <div><p>你的 BMI 是 $mybmi </p></div> eof; // echo $mymsg; } if (isset($myh)) echo "value='$myh'"; if (isset($myw)) echo "value='$myw'"; if (isset($mymsg)) echo $mymsg; ?>