how do I display a field when I have used a GET command to get it from the address bar from the previous page and then display it in my table?
I have tried to display the field already in the table but no luck. the field is call "Reference"
using the below I want to get the reference into the table. (I have tried the following echo "" . $row['$Reference'] . "";)
http://test.com/searchresults.php?Reference=456789 $Reference=$_GET['Reference'];
search results page
<?php
require_once('auth.php');
$host=""; // Host name
$username=""; // Mysql username
$password=""; // Mysql password
$db_name=""; // Database name
$tbl_name="Physio"; // Table name
// Connect to server and select database.
mysql_connect($host, $username, $password)or die("cannot connect");
mysql_select_db($db_name)or die("cannot select DB");
// get value of Reference that sent from address bar
$Reference=$_GET['Reference'];
$sql="SELECT * FROM $tbl_name WHERE Reference='$Reference'";
$result=mysql_query($sql);
$rows=mysql_fetch_array($result);
if(!isset($_POST['postcode'])) {
header ("location:index.php");
}
echo "<p> Results </p>" ;
$search_sql = "SELECT * FROM `Physio` WHERE Postcode like '%" . $_POST['postcode'] . "%'";
$search_query = mysql_query($search_sql);
while ($search_rs = mysql_fetch_array($search_query))
{
echo"<table><tr>" ;
echo '<th>Reference</th><th>Select</th><th>PhysioReference</th><th>Physio</th><th>Postcode</th><th>Line1</th><th>Tel</th>';
while ($search_rs = mysql_fetch_array($search_query))
{
echo '<tr>';
echo "<td>" . $row['$Reference'] . "</td>";
echo "<td><a href=\"Physiotoinstruction.php?Reference={$search_rs['Reference']}\">Select</a></td>";
echo "<td>".$search_rs['PhysioReference'] . "</td>";
echo "<td>".$search_rs['Name'] . "</td>";
echo "<td>".$search_rs['Postcode'] . "</td>";
echo "<td>".$search_rs['Line1'] . "</td>";
echo "<td>".$search_rs['Tel'] . "</td>";
echo '</tr>';
}
echo '</table>';
}
if (!empty($search_rs))
{
echo "<p> Results Found </p>" ;
}
else
{
echo "<p> No Results Found </p>" ;
}
?>