-1

此代码返回我无法通过修改代码解决的 404 Object Not Found 错误。而且我不知道这是代码问题还是本地主机问题。我需要为我的最后一年项目运行它。请帮忙。非常感谢你们。

<?php

 session_start();

 require "dbc.php";

 echo "<center>";
 echo "<img src='web_header.jpg'/>";
echo "</center>";

if($_SESSION['admin_username'])
{
echo "Hello : ".$_SESSION['admin_username'];

echo "<p><a href ='admin_panel.php'>Admin Main</a> || <a href='manage_patients.php'>Manage Patients</a> || <a href ='manage_doctor.php'>Manage Doctors</a> || <a href ='mail_form.php'>Send Email</a> || <a href='logout.php'>Logout</a> "; 

echo "<title>Manage Patients</title>";

echo "<h2>Manage Patients</h2>";

$query = mysql_query("SELECT * FROM users");
$numrows = mysql_num_rows($query);

if ($numrows != 0)

{
    echo "<table width='1285' height='102' border='1'>";
    echo "<tr><th>ID</th><th>Name</th><th>IC Number</th><th>Address</th><th>Mobile Number</th><th>E-mail Address</th><th>Doctor ID</th></tr>";
    while ($rows = mysql_fetch_assoc($query))
    {
        echo "<tr>";
        echo "<td width='57' height='33'>";
        echo "<center>";
        echo $rows['id'];
        echo "</center>";
        echo "</td>";
        echo "<td width='173'>";
        echo $rows['name'];
        echo "</td>";
        echo "<td width='113'>";
        echo "<center>";
        echo $rows['icnum'];
        echo "</center>";
        echo "</td>";
        echo "<td width='622'>";
        echo $rows['address'];
        echo "</td>";
        echo "<td width='110'>";
        echo "<center>";
        echo $rows['mobile'];
        echo "</center>";
        echo "</td>";
        echo "<td width='170'>";
        echo "<center>";
        echo $rows['email'];
        echo "</center>";
        echo "</td>";
        echo "<td width='90'>";
        echo "<center>";
        echo $rows['docID'];
        echo "</center>";
        echo "</td>";
        echo "</tr>";
    }   
   echo "</table>";

   echo"<br>";
   echo"</br>";
   echo "<form action = 'manage_patients.php method=POST'>";
   echo "<p>Assign Doctor ID : ";
   echo "<input type='text' name='assign_id' value='Insert Doctor ID Here'>";
   echo " for Patient ID : ";
   echo "<input type='text' name='id' value='Insert Patient ID Here'></p>";
   echo "<input type= 'submit' name='submit' value='Assign Now'>";
   echo "</form>";

if (isset($_POST['submit']))
{
    require "dbc.php";
    $name = mysql_real_escape_string($_POST['assign_id']);
    $id   = mysql_real_escape_string($_POST['id']);
    $query = mysql_query("UPDATE users SET docID='$assign_id' WHERE id='$id'");
    echo "Doctor ID Successfully Assigned for Patient ID : $name ";
    echo "<p>Refresh page to view changes.</p>";
}   

}


 }
 else
{
header("location:index.html");  

}

?>
4

3 回答 3

2

如果您收到 404 错误,则表示找不到该页面。因此,您的代码很可能不是问题(这会给您带来 500 服务器错误)。相反,您很可能使用了错误的 URL。

于 2013-04-12T19:26:22.633 回答
2

改变这个

 <form action = 'manage_patients.php method=POST'>

<form action = 'manage_patients.php' method='POST'>
于 2013-04-12T19:31:02.893 回答
1
<form action = 'manage_patients.php method=POST'> 

我觉得你的这行有点可疑

于 2013-04-12T19:29:30.627 回答