Rumah >pembangunan bahagian belakang >tutorial php >PHP按钮返回404异常
PHP按钮返回404错误
书上的内容,然后已经建立了数据库和login.php文件。
<?php<br /> require_once 'login.php';<br /> $db_server = mysql_connect($db_hostname,$db_username,$db_password);<br /><br /> if(!$db_server)die("Unable to connect to MySQL:".mysql_error());<br /><br /> mysql_select_db($db_database)<br /> or die("Unable to select to MySQL:".mysql_error());<br /> <br /> if(isset($_post['delete']) && isset($_POST['isbn']))<br /> {<br /> $isbn = get_post('isbn');<br /> $query = "DELETE FROM classics WHERE isbn='$isbn'";<br /> <br /> if(!mysql_query($query, $db_server))<br /> echo "DELETE failed: $query<br />".mysql_error()."<br /><br />";<br /> }<br /> <br /> if(isset($_post['author']) &&<br /> isset($_post['title']) &&<br /> isset($_post['category']) &&<br /> isset($_post['year']) &&<br /> isset($_post['isbn']))<br /> {<br /> $author = get_post('author');<br /> $title = get_post('title');<br /> $category = get_post('category');<br /> $year = get_post('year');<br /> $isbn = get_post('isbn');<br /> <br /> $query = "INSERT INTO classics VALUES".<br /> "('$author','$title','$category','$year','$isbn')"; <br /> <br /> if(!mysql_query($query, $db_server))<br /> {<br /> echo "INSERT failed: $query<br />".mysql_error()."<br /><br />";<br /> }<br /> }<br /> <br /> echo <<<_END<br /><br /> <form action="sqltext.php" method="post"><br /> <br /> <pre class="brush:php;toolbar:false"><br /> <br /> Author <input type="text" name="author" /><br /> Title <input type="text" name="title" /><br /> Category <input type="text" name="category" /><br /> year <input type="text" name="year" /><br /> ISBN <input type="text" name="isbn" /><br /> <br /> <input type="submit" value="ADD RECORD" /><br /> <br />
<br> Author $row[0]<br> Title $row[1]<br> category $row[2]<br> year $row[3]<br> ISBN $row[4]<br>