I have two pages:
1- CompanySelect.php
2- CompanyData.php
The page 1 gives a list of options to select:
echo'<form action="companyList.php" method="post">';
echo'<select name="ID_Client">'; //That`s the Referenced column
echo'<option value="0" label="coyvalue" selected="selected"> Select Company </option>';
while($row = mysql_fetch_array($tIDENTITY_Execution, MYSQL_ASSOC)){
$ID_Client = $row['ID_Client'];
$Comp_Name = $row['Comp_Name'];
echo'<option value= "'.$ID_Client.'">'.$Comp_Name.'</option>';
}
mysql_free_result($tIDENTITY_Execution);
echo'</select>';
echo'<input type = "submit" />';
echo '</form>';
The page 2 shows information about the Company Selected. I would like to add a link in one of the columns to ORDER BY DATE. Please se below part of the code:
//Using Get to order the list
$order = $_GET["order"];
//If any order selected, default = Last Communication Date
if(!isset($order)){
$order = "Last_Communication_Date";
}
enter code here
$tsales_cmd = " SELECT *";
$tsales_cmd .= " FROM tsales_history ";
$tsales_cmd .= " WHERE tIDENTITY_ID_Client = '".$companyID."' ";
$tsales_cmd .= " ORDER BY ";
$tsales_cmd .= " tsales_history.".$order;
$header_lastComm = '<a href = "'.$thisScriptName.'?order=Last_Communication_Date"><span class = "tableHeader"> LAST COMM </span> </a>';
...
echo "<table border = '1' padding = '2'>";
echo '<tr>
<td> Average Order </td>
<td> Last Order Date </td>
<td> '.$header_lastComm.'</td>
<td> Product Bought </td>
<td> Services Bought </td>
<td> After Sale Service </td>
<td> Market Share </td>
</tr> ';
However, I am losing the ID Selected. How could I fix this problem?
Aucun commentaire:
Enregistrer un commentaire