What do I have now:
I have a search system that's based on the _POST method, and it shows some info of the results on the same page. Works, but could be a little more detailed.
What I want to do:
I want to make the ID field clickable, and whenever I click it, it goes to another page where it shows all of the information about that item that's stored on the database.
What I don't know how to do:
I don't know how to make the ID field of the result clickable, and I don't know how I can "transport" that variable to the other page. (e.g. I click on the ID that lists "08859", and when I click it, it goes to another page with that variable, without me having to type it again).
This is an excerpt of my page, because most of it is repetition, and it is over 600 lines.
Code: Select all
<HTML>
<HEAD>
<TITLE>Busca de Ordem de Serviço</TITLE>
<link rel="stylesheet" type="text/css" href="style.css" />
</HEAD>
<BODY>
<?php
include 'verifica_usuario.ink';
?>
<FORM NAME ="oscodigo" METHOD ="POST" ACTION = "OS.php">
<br><b>Procurar por:</b>
<INPUT TYPE = "TEXT" VALUE ="" NAME="ostext"><br>
<br>
<input type="radio" name="type" value="todos" checked>Todas as OSs
<input type="radio" name="type" value="OScodigo">Código da OS
<input type="radio" name="type" value="CliFantas">Nome Fantasia
<input type="radio" name="type" value="TecNome">Nome do Técnico
<br>
<input type="radio" name="status" value="AB" checked>OSs Abertas
<input type="radio" name="status" value="OK">OSs Fechadas
<input type="radio" name="status" value="ALL">Todas
<br><br>
<INPUT TYPE = "Submit" Name = "osbtn" VALUE = "Procurar">
</FORM>
<?php
include 'connect.os.php';
if ((isset($_POST['osbtn']))){
$text = $_POST["ostext"];
$stats = $_POST["status"];
$type = $_POST["type"];
}
else {
$text = "";
$stats = "";
$type = "";
};
if ((isset($_POST['osbtn'])) && ($type == "todos")){
$data = mysql_query("SELECT *, DATEDIFF(CURRENT_TIMESTAMP,DataAB) AS dias , date_format(DataAB, '%d/%m/%Y') AS DataAB, tecnome FROM os JOIN tecnico ON atendido = teccodigo WHERE status = '$stats' ORDER BY dias")
or die(mysql_error());
$linhas_db = mysql_num_rows($data);
$linhas = 0;
echo "<div align=center>
<table border = 2><tr>
<th>OS#</th>
<th>Nome Fantasia</th>
<th>Requisitante</th>
<th>Abertura</th>
<th>Responsável</th>
<th>Dias</th>
<th>ID</th>
<th>Problema</th>
<th>Status</th></tr>";
while ($linhas_db > $linhas) {
$info = mysql_fetch_array($data);
echo "<tr><td>";
echo $info['osCodigo'];
echo "</td><td>";
echo $info['CliCodigo'];
echo " - ";
echo $info['CliFantas'];
echo "</td><td>";
echo $info['Requisitante'];
echo "</td><td>";
echo $info['DataAB'];
echo "</td><td>";
echo $info['TecNome'];
echo "</td><td>";
echo $info['dias'];
echo "</td><td>";
echo $info['OS_Cliente'];
echo "</td><td>";
echo $info['Reclamacao'];
echo "</td><td>";
echo $info['Status'];
echo "</td></tr>";
$linhas++;
}
echo "</table></div>";
}