如何获取信息

时间:2016-12-08 23:35:11

标签: php

我如何从“查看”页面获取一些信息并将其传递到不同的页面。

这是视图页面。我想将Patient_Name和Date传递给PrintMC2中特定区域的“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>   

这是Print MC页面代码:

<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>

当用户点击特定名称上的链接时,我想将Patient_Name传递给printMC页面

enter image description here

1 个答案:

答案 0 :(得分:0)

如果您不想使用GET参数进行链接,我建议将此信息保存在cookie或会话中,并在下一页中使用它。