0

How do I want to get some info's from View page and pass it into different page.

This is the view page. I want to take Patient_Name and Date and pass to "PrintMC2" page at the specific area in the PrintMC2:

<html>
<head>
<style>
h2
{
  font-style: georgia;
   color:black;
   font-size:250%

}

body{
    background-image: url("p8.jpg");
    background-size: 100% 800px;
}
table {
   border-collapse: collapse;
   width: 80%;
}

th, td {
    text-align: center;
    padding: 10px;
}

tr:nth-child(even){background-color: #A9A9A9}

th {
    background-color: #4CAF50;
    color: white;
}
</style>
    <title>Document Title</title>
</head>
<body>
<?php

 $page_title ='View the diagnosis';

echo'<center><h2 id="mainhead">Diagnosis Details</h2></center>';

require_once ('mysql_connect.php');

$query = "SELECT * FROM patients";
$result = @mysql_query($query);
$num = @mysql_num_rows($result);

if ($num > 0)
{
  echo"<center>There are currently $num diagnosis.\n";
  echo'<table  border align="center" cellspacing="0" cellpadding="5">
  <tr>
  <td align="center"><b>Patient ID</b></td>
  <td align="center"><b>Name</b></td>
  <td align="center"><b>IC Number</b></td>
  <td align="center"><b>Symptom</b></td>
  <td align="center"><b>Disease</b></td>
  <td align="center"><b>Prescription</b></td>
  <td align="center"><b>Medical Certificate</b></td>
  <td align="center"><b>Print</b></td>
  </tr>';

  while($row = mysql_fetch_array($result, MYSQL_ASSOC))
  {
    echo'<tr>
    <td align="center">' . $row['ID'].'</td>
    <td align="center">' . $row['Name'].'</td>
    <td align="center">' . $row['IC_Number'].'</td>
    <td align="center">' . $row['Symptom'].'</td>
    <td align="center">' . $row['Disease'].'</td>
    <td align="center">' . $row['Prescription'].'</td>
    <td align="center">' . $row['Medical_Certificate'].'</td>
    <td><a href="PrintMC2.php?next_page=PrintMC2.php">Link to Print MC</a>         </td>
</tr><br/>';
  }

     echo'</table>';
     mysql_free_result($result);
  }
else
{
  echo'<p class="error">There are currently no diagnosis.</p>';
}
 mysql_close ();
?>

<br /> 
<br />
<br />
<br /> 
<br />
<br />
<br /> 
<br />
<br />
<br /> 
<br />
<br />
<br />
<br /> 
<br />
<br />

<?php
  include ('./includes/footer.html');
?>
</body>
</html>   

This are the Print MC page code:

<html>
<head>
<style>
h2
{
  font-style: georgia;
  color:black;
  font-size:250%

}

body{
   background-image: url("p8.jpg");
   background-size: 100% 800px;
}
#frm{
  border: solid gray 1px;
  width: 40%;
  border-radius: 5px;
  margin: 100px auto;
  background: white;
  padding: 40px;
}

#btn{
 color: #fff;
 background: #000;
 padding: 8px;
 margin_left: 70%;
}

</style>
<head>
<link rel="stylesheet" type="text/css" href="print.css" media="print">
<title>Clinic Management System</title>
</head>
<body>
 <div id="button"><input type="button" onclick="window.print()" id="btn"      value="Print Here"/></div></div></div>
   <div id="frm">
      <p id="p1"><center><h1>Medical Certificate</h1></center>

               To whom it may concern, </p>

               This is to certify that.....................[name of the patient] </p>

               of ................................................................</p>

               Was examined and treated at the clinic Al-Munawarah</p>

               on ..........................[date] with the followig diagnosis.</p>        

               .........................................................................................</p>

               .........................................................................................</p>

               And would need medical attention for .......................... days barring complication.</p>
               <br/>

                                                     ...................  </p>
                                                     Doctor(s) Signature      </p>
</div>                           
</body>
</html>

When User click the link on the specific name, I want to pass the Patient_Name to the printMC page where

enter image description here

Isaac Bennetch
  • 11,830
  • 2
  • 32
  • 43
  • So add a querystring to the anchor tags `href` attribute – RiggsFolly Dec 08 '16 at 23:47
  • Sees `mysql_*`.. cries in a corner.. on a medical website even :'( – icecub Dec 08 '16 at 23:49
  • 1
    Every time you use [the `mysql_`](http://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php) database extension in new code **[a Kitten is strangled somewhere in the world](http://2.bp.blogspot.com/-zCT6jizimfI/UjJ5UTb_BeI/AAAAAAAACgg/AS6XCd6aNdg/s1600/luna_getting_strangled.jpg)** it is deprecated and has been for years and is gone for ever in PHP7. If you are just learning PHP, spend your energies learning the `PDO` or `mysqli` database extensions. [Start here](http://php.net/manual/en/book.pdo.php) – RiggsFolly Dec 08 '16 at 23:51
  • And dont use `@` error silencer – RiggsFolly Dec 08 '16 at 23:52
  • So where is `date` as you dont seem to use it anywhere. Is it returned as part of the `SELECT * FROM patients`? That would seem unlikely! – RiggsFolly Dec 09 '16 at 00:09

1 Answers1

0

If you don't want use GET parameters to link, I advice to save this info in cookie or session, and use it in next page.