利用php可以读取数据库的内容,但是当提交表单到数据库,点击submit按钮的时候却出现
Access forbidden!
You don't have permission to access the requested object. It is either read-protected or not readable by the server. If you think this is a server error, please contact the webmaster. 以下是源码:
<html>
<body>
<?php
if ($submit) {
// 处理表格输入 $db = mysql_connect("localhost", "root"); mysql_select_db("mydb",$db); $sql = "INSERT INTO employees (first,last,address,position)
VALUES ('$first','$last','$address','$position')"; $result = mysql_query($sql); echo "Thank you! Information entered.\n";} else{
// 显示表格内容 ?> <form method="post" action="<?php echo $PATH_INFO?>">
名:<input type="Text" name="first"><br>
姓:<input type="Text" name="last"><br>
住址:<input type="Text" name="address"><br> 职位:<input type="Text" name="position"><br> <input type="Submit" name="submit" value="输入信息"> </form> <?php} // end if,if结束
?></body></html>
Access forbidden!
You don't have permission to access the requested object. It is either read-protected or not readable by the server. If you think this is a server error, please contact the webmaster. 以下是源码:
<html>
<body>
<?php
if ($submit) {
// 处理表格输入 $db = mysql_connect("localhost", "root"); mysql_select_db("mydb",$db); $sql = "INSERT INTO employees (first,last,address,position)
VALUES ('$first','$last','$address','$position')"; $result = mysql_query($sql); echo "Thank you! Information entered.\n";} else{
// 显示表格内容 ?> <form method="post" action="<?php echo $PATH_INFO?>">
名:<input type="Text" name="first"><br>
姓:<input type="Text" name="last"><br>
住址:<input type="Text" name="address"><br> 职位:<input type="Text" name="position"><br> <input type="Submit" name="submit" value="输入信息"> </form> <?php} // end if,if结束
?></body></html>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货