<?php
extract($_REQUEST);
if(isset($subject)&&isset($body)){
if( mysql_connect("localhost","root","")){
mysql_select_db("test");
mysql_query("INSERT INTO message (subject,body) VALUE ('$subject','$body')");
$status="Message <i>$subject</i>has been posted<br/><br/>";}
else{
echo "hello world";
}
}
?>
<html>
<body>
<?php $str="hello"; ?>
<h2><?=$str?></h2>
<h1>Post a Message</h1>
<strong><?=$status?></strong>
<form action="<?=$_SERVER['PHP_SELF']?>">
Subject <input type="text" name="subject" size="35">
<br/><br/>
<textarea name="body" cols="40" rows="15"></textarea>
<br/><br/>
<input type="submit" value="Post">
</form>
</body>
</html>
和预期的有点不符合