作者andraw (安卓罗)
看板PHP
标题[请益] form表单无法输出至下一页
时间Mon Jun 19 15:53:44 2006
这实在是一个很简单很单纯的 php 读取表单的网页,
可是无奈太久没有碰 php,
我竟然连这个也搅不定..Orz..。
我是使用 EasyPHP 1.7 版此套装程式,
包含了 PHP4.3.3、MySQL4.0.15、Apache1.3.27、PhpMyAdmin2.5.3,
而参考书目则是 PHP4 网站实作,作者为陈俊宏,
以下为书中的留言板范例,
无奈我怎麽跑都跑不出来,
还麻烦版上的前辈多多帮忙指教~~
////////////////////////////////////////////////////////////////////
// 以下为 post.html 表单的html码
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
<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">
<strong>笔名</strong></td>
<td width="89%">
<input type="text" name="username" size="20"></td>
</tr>
<tr>
<td width="11%" bgcolor="#C0C0C0">
<strong>E-Mail</strong></td>
<td width="89%">
<input type="text" name="email" size="20"></td>
</tr>
<tr>
<td width="11%" bgcolor="#C0C0C0" valign="top">
<strong>留言</strong></td>
<td width="89%">
<textarea rows="4" name="message" cols="36">
</textarea><br>
<input type="submit" value="送出" name="B1">
<input type="reset" value="重填" name="B2"></td>
</tr>
</table>
</center></div>
</form>
</body>
</html>
// 以下为 show.php 输出页
<?php
echo "笔名:$username<br>";
echo "E-Mail:$email<br>";
echo "留言:<br>$message";
?>
////////////////////////////////////////////////////////////////////
我按下送出後,
show.php 的网页呈现出以下:
Notice: Undefined variable: username in c:\program files\easyphp1-7\www\php4www
\ch04\show.php on line 2
笔名:
Notice: Undefined variable: email in c:\program files\easyphp1-7\www\php4www\ch
04\show.php on line 3
E-Mail:
Notice: Undefined variable: message in c:\program files\easyphp1-7\www\php4www\
ch04\show.php on line 4
留言:
未定义的变数?
是我的php设定上有问题?
EasyPHP启动之後应该就启动所有了吧?!~
不知道是哪个环节出问题~
麻烦帮我看一下噜~
这个应该是个小问题吧....Orz...感谢先噜~!!!
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 218.168.78.108
1F:推 emn178:php.ini有设定global吗 没有的话要用$_POST['xxx']吧 06/19 16:19
2F:→ andraw:大感谢!! 原来在php.ini中有两个 register_globals = Off~ 06/19 17:02
3F:→ andraw:我只改了一个 register_globals = on ! 刚刚两个都改成on 06/19 17:03
4F:→ andraw:就可以跑出来了!太感谢了!! >"< !! 06/19 17:04
5F:→ andraw:不过..请问一下..若是使用 $_POST['xxx']..是加在哪儿呢?? 06/19 17:06
6F:推 litthe:echo $_POST['email'] ; echo $_POST['username']; 06/19 18:35