|
发表于 2004-9-16 11:52:27
|
显示全部楼层
Re: 一个PHP例子的问题
[quote:9cd181658d="ajinn"]下面这段很典型PHP例子,运行时只有else后面有用,
也就是不显示"Thank you! Information entered.\n"这段,表personnel里也没有
新插入的内容,
这里请教大家,一并了解一下大家对PHP程序是怎么调试的?
[code:1]<HTML>
<?php
if($submit)
{
$db = mysql_connect("localhost", "root","");
mysql_select_db("learndb",$db);
$sql = "INSERT INTO personnel (firstname, lastname, nick, email, salary) VALUES ('$first','$last','$nickname','$email','$salary')";
$result = mysql_query($sql);
echo "Thank you! Information entered.\n";
}
else
{
?>
<form method="post" action="input.php">
First name:<input type="Text" name="first"><br>
Last name:<input type="Text" name="last"><br>
Nick Name:<input type="Text" name="nickname"><br>
E-mail:<input type="Text" name="email"><br>
Salary:<input type="Text" name="salary"><br>
<input type="Submit" name="submit" value="Enter information"></form>
<?
}
?>
</HTML>[/code:1][/quote]
看上去结构完全正确阿,我也搞不明白是怎么回事 |
|