Home  >  Article  >  Backend Development  >  PHP按钮返回404错误

PHP按钮返回404错误

WBOY
WBOYOriginal
2016-06-23 13:39:51874browse

书上的内容,然后已经建立了数据库和login.php文件。

<?php    require_once 'login.php';    $db_server = mysql_connect($db_hostname,$db_username,$db_password);    if(!$db_server)die("Unable to connect to MySQL:".mysql_error());    mysql_select_db($db_database)    or die("Unable to select to MySQL:".mysql_error());        if(isset($_post['delete']) && isset($_POST['isbn']))    {        $isbn = get_post('isbn');        $query = "DELETE FROM classics WHERE isbn='$isbn'";                if(!mysql_query($query, $db_server))        echo "DELETE failed: $query<br />".mysql_error()."<br /><br />";    }        if(isset($_post['author']) &&       isset($_post['title']) &&       isset($_post['category']) &&       isset($_post['year']) &&       isset($_post['isbn']))        {            $author = get_post('author');            $title = get_post('title');            $category = get_post('category');            $year = get_post('year');            $isbn = get_post('isbn');                          $query = "INSERT INTO classics VALUES".              "('$author','$title','$category','$year','$isbn')";                            if(!mysql_query($query, $db_server))            {                echo "INSERT failed: $query<br />".mysql_error()."<br /><br />";            }        }        echo <<<_END        <form action="sqltext.php" method="post">                    <pre class="brush:php;toolbar:false">                                  Author <input type="text" name="author" />                   Title <input type="text" name="title" />                Category <input type="text" name="category" />                    year <input type="text" name="year" />                    ISBN <input type="text" name="isbn" />                                        <input type="submit" value="ADD RECORD" />                        
                        _END;        $query = "SELECT * FROM classics";    $result = mysql_query($query);        if(!$result) die("Datebase access failed: ".mysql_error);        $rows = mysql_num_rows($result);        for($j = 0; $j               Author $row[0]                Title $row[1]             category $row[2]                 year $row[3]                 ISBN $row[4]                

                                
            _END;    }        mysql_close($db_server);        function get_post($var)    {            return mysql_real_escape_string($_POST[$var]);    }?>
该网页显示正常,但是一按ADD RECODE按钮就会出现Object Not Found错误,并且底下有Error 404。
求大神帮忙呢。。。


回复讨论(解决方案)

加断点一步一步调试。


sqltext.php ??文件有??

sqltext.php 存在吗?

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn