<html>
<head>
<title>神经留言板</title>
</head>
<body>
<form method="POST" action="show.php">
<div align="center">
<center>
<table border="0" width="80%" cellspacing="1">
<tr>
<td width="11%" bgcolor="#c0c0c0">马甲:</td>
<td width="89%"><input type="text" name="username"></td>
</tr>
<tr>
<td width="11%" bgcolor="#c0c0c0">E-mail:</td>
<td width="89%"><input type="text" name="email"></td>
</tr>
<tr>
<td width="11%" bgcolor="#c0c0c0">留言:</td>
<td width="89%"><textarea rows="4" cols="36">请遵守道德和法律</textarea></td>
</tr>
<tr>
<td><input type="submit" value="送出" name="B1"></td>
<td<input type="reset" value="重填" name="B2"></td>
</tr>
</table>
</center>
</div>
</form>
</body>
</html>
show.php文件为<?php
echo "用户名:$username";
echo "电子邮件:$email";
echo "留言内容:$message";
?>
但是显示为
Notice: Undefined variable: username in E:\wamp\www\liuyanban\show.php on line 2
用户名:
Notice: Undefined variable: email in E:\wamp\www\liuyanban\show.php on line 3
电子邮件:
Notice: Undefined variable: message in E:\wamp\www\liuyanban\show.php on line 4
留言内容:变量为什么没有传递到呢??

解决方案 »

  1.   

    你的技术太落后了,现在已经不这么做了,买本新的书看看吧,
    echo "用户名:$_POST['username']"; 
    echo "电子邮件:$_POST['$email']"; 
    echo "留言内容:$_POST['message']";
      

  2.   

    多谢。话说我脑子突然灵光起来了。想起来了这个$_POST数组的问题。我手上的这本是01年7月的。
      

  3.   


    echo "用户名:".$_POST['username'];
    echo "电子邮件:".$_POST['email'];
    echo "留言内容:".$_post['message'];这个应该有个给个name
    <textarea rows="4" cols="36" name='message'>请遵守道德和法律 </textarea>