Question

This code returns me a 404 Object Not Found error that I could not solve by modifying the code. And I don't know whether it's a code problem or a localhost problem. I need this to be running for my Final Year Project. Please help. Thanks a lot guys.

<?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");  

}

?>
Was it helpful?

Solution

change this

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

to

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

OTHER TIPS

If you are getting a 404 Error, it means that the page could not be found. So it is most likely not a problem with your code (that would give you a 500 Server Error). Instead you most likely have used the wrong URL.

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

I find this line of yours a bit suspiscious

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top