Note that there are some explanatory texts on larger screens.

plurals
  1. PODisplay HTML form depending on employee title
    text
    copied!<p>I have an update page where I check the title of the employee whether he is a doctor or a nurse. If the employee is a doctor/nurse an HTML form will be shown, if not a doctor/nurse, patient information will only be displayed and cannot be edited. But my code somehow skips the part where I wanted to display the form even if I am logged in as a doctor/nurse. Can you please help me with this.... </p> <pre><code>&lt;?php $a=$_SESSION['employeeID']; $title="SELECT title FROM employee WHERE employeeID = '$a'"; if($title == 'nurse' OR $title == 'doctor') { echo '&lt;form method="post" id="customForm" action="add_assessment.php"&gt; &lt;table&gt; &lt;input type="hidden" name="res_id" value="' . $_GET['res_id'] . '" /&gt; &lt;tr&gt; &lt;td&gt;&lt;label for="name"&gt;&lt;font style="color:white"&gt;Symptoms&lt;/font&gt;&lt;font style="color:gray"&gt;&lt;/font&gt;&lt;/label&gt; &lt;input id="name" name="symptoms" type="text" /&gt;&lt;/td&gt; &lt;td&gt;&lt;label for="name"&gt;&lt;font style="color:white"&gt;Respiratory Rate&lt;/font&gt;&lt;/label&gt; &lt;input id="name" name="respiratoryRate" type="text" /&gt;&lt;/td&gt; &lt;td&gt;&lt;label for="name"&gt;&lt;font style="color:white"&gt;Temperature&lt;/font&gt; &lt;font style="color:gray"&gt;&lt;/font&gt;&lt;/label&gt; &lt;input id="name" name="temperature" type="text" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;label for="name"&gt;&lt;font style="color:white"&gt;Blood Pressure&lt;/font&gt;&lt;/label&gt; &lt;input id="name" input name="bloodPressure" type="text" class="input2"/&gt;&lt;/td&gt; &lt;td&gt;&lt;label for="name"&gt;&lt;font style="color:white"&gt;Pulse Rate&lt;/font&gt;&lt;/label&gt; &lt;input id="name" input name="pulseRate" type="text" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;label for="name"&gt;&lt;font style="color:white"&gt;Chief Complaint&lt;/font&gt;&lt;/label&gt; &lt;input id="name" input name="complaint" type="text" class="input2"/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&amp;nbsp;&lt;/td&gt; &lt;td&gt;&amp;nbsp;&lt;/td&gt; &lt;td&gt;&lt;input id="send" name="send" type="submit" value="Submit" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/form&gt;'; } else { $host="localhost"; $username="root"; $password=""; // password $db_name="rhu"; // Database name $tbl_name="assessment"; // Table name mysql_connect("$host", "$username", "$password"); mysql_select_db("$db_name"); $id = $_GET['res_id']; $sql = mysql_query("SELECT * FROM assessment WHERE patientID='$id'"); while($row = mysql_fetch_array($sql)) { echo "&lt;p&gt;ID: ".$id."&lt;/p&gt;"; echo "&lt;p&gt;Assessment ID: ".$row['assessmentID']."&lt;/p&gt;"; echo "&lt;p&gt;Symptoms: ".$row['symptoms']."&lt;/p&gt;"; echo "&lt;p&gt;Respiratory Rate: ".$row['respiratoryRate']."&lt;/p&gt;"; echo "&lt;p&gt;Temperature: ".$row['temperature']."&lt;/p&gt;"; echo "&lt;p&gt;Blood Pressure: ".$row['bloodPressure']."&lt;/p&gt;"; echo "&lt;p&gt;Pulse Rate: ".$row['pulseRate']."&lt;/p&gt;"; echo "&lt;p&gt;Complaints: ".$row['complaint']."&lt;/p&gt;"; echo "&lt;p&gt;Date: ".$row['date']."&lt;/p&gt;"; echo "&lt;br&gt;"; } } ?&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload