Jump to content

<a href> link to fill page with different data


jpglotzer

Recommended Posts

Hi people,

 

I've been having trouble with this for a while now. Basically, i have this website: http://el07jpg.info . You can log in with username:doctor1 password:password1

 

Once you've logged on, u can click on "Patients". Then, if you click on a patient, it shows their info. Then at the bottom, I have links to glucose readings and heart rate readings... but when I click on either of those links, it goes back to the main page, showing all the patients..

 

The weird thing is that I got this to work for the first step, u click on the <a href> link of a patient, and it brings you to their page. Then I've done the EXACT same thing to link to the glucose or heart rate readings of that specific patient, but it doesn't work. I really can't see what i've done wrong. Although I noticed in the address bar, when I click on glucose readings for example, the url is http://el07jpg.info/index.php?op=patients&id=&reading=glucose (id should be equal to a number, like id=4, but there's no number... Any help would be much appreciated! Cheers! Code for op_patients.php page:

 

 

<?php

 

//Page if a set of records is selected from a single patient's page

 

if ($_REQUEST[reading]+0) {

 

        $GLOBALS['html']['css'][]="default.css";

$reading_source=$_REQUEST[reading]+0;

$sql="select * from {$reading_source}_readings where patientRFID='{$patient[patientRFID]}' ";

$results=mysql_select_assoc($sql);

if (!$results){

$GLOBALS[err][]="No records exist!";

exit;

}

 

$GLOBALS['html']['title']="Patient: {$patient[first_name]} {$patient[last_name]}'s {$reading_source} readings ";

       

        echo $reading_source;

}

 

//Page if a single patient is selected

 

if ($_REQUEST[id]+0) {

 

        $GLOBALS['html']['css'][]="default.css";

$id=$_REQUEST[id]+0;

$sql="select * from patients where doctorID='{$_SESSION[user][id]}' and patientID='$id' ";

$patient=mysql_select_assoc($sql);

if (!$patient){

$GLOBALS[err][]="The patient can't be found!";

exit;

}

 

$GLOBALS['html']['title']="Patient: {$patient[last_name]}, {$patient[first_name]} ";

       

$output.="

        <br>

        <table border='1' cellpadding='5' cellspacing='5' width='600'>

        <tr><td rowspan=6><img src=\"$patient[photo]\"> </td>

        <th>Name: </th><td>{$patient[first_name]} {$patient[last_name]} </td></tr>

        <tr><th>D.O.B: </th><td>{$patient[dob]} </td></tr>

        <tr><th>Email: </th><td>{$patient} </td></tr>

        <tr><th>Phone Number: </th><td>{$patient[phone_no]}</td></tr>

        <tr><th>Address: </th><td>{$patient[address]}</td></tr>

        <tr><th><br> Comments:<br> </th>

        <td>{$patient[comments]} </td></tr>

        </table>

 

        <table border='1' cellpadding='5' cellspacing='5' width='600'>

        <tr><th colspan=3><br>Medical Readings<br><br></th></tr>

        <tr>

        <td align='center' width='300'>

        <a href='index.php?op=patients&id={$v[patientID]}&reading=glucose'>Glucose Readings</a>

        </td>

<td colspan=2 align='center' width='300'>

<a href='index.php?op=patients&id={$v[patientID]}&reading=heart'>Heart Rate Readings</a>

</td>

</tr> 

        </table>

";

 

echo $output;

        exit;

}

 

//Main Page showing all patients

 

$GLOBALS['html']['title']="Patients";

$GLOBALS['html']['css'][]="default.css";

 

if(!$_SESSION[user][id]) {

        $er="Access Denied! Please Log in.";

        echo "<div style='color:red;'>$er</div>";

} else {

 

 

$sql="select * from patients where doctorID='{$_SESSION[user][id]}' order by last_name";

$d=mysql_getarray_assoc($sql);

$output='';

foreach ($d as $v){

$output.="

<tr><td>

<a href='index.php?op=patients&id={$v[patientID]}'>{$v[last_name]}, {$v[first_name]}</a>

</td></tr>

";

}

 

echo "

<table width=80% align=left border='1' cellpadding='5' cellspacing='5' width='100%'>

<tr><th class=popupheader align='left'>

Patient Name<br><br>

</th></tr>

$output

</table>

";

 

}

 

 

?>

 

 

Link to comment
Share on other sites

      <a href='index.php?op=patients&id={$v[patientID]}&reading=glucose'>Glucose Readings</a>

 

You can probably use $id here instead of $v[patientID].  I can see $id being used in the select query already.

Link to comment
Share on other sites

reading is a string, but your code has "$_REQUEST[reading]+0", which is typically used as a method of turning a string into an integer.  So the first thing to do is remove the "+0" from each spot where you use $_REQUEST['reading'].

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.