I have a inital search form to filter search results that only have a certain name ($nomeconstrutoras in this case). The Results page should display all the resulta if $nomeconstrutoras isn't set, and if it is it should filter ou the results.
Problem is, none of them work. Nothing displays, not even when I don't filter the search out. Here is the code for both:
SEARCH
echo '<form method="post" action="results.php">';
echo 'Listar Obras por Construtora: <select name="construtorasearch" size="1">';
include "connect_mysql.inc";
$result = mysql_query("SELECT nomeconstrutora FROM construtoras");
while($query_data = mysql_fetch_row($result)) {
echo "<option value=\"". $query_data[0] . "\">" . $query_data[0] . "</option>\n";
}
[/B]
RESULTS.PHP
if(construtorasearch){
$result = mysql_query("SELECT obraid FROM obras WHERE construtora='construtorasearch' ORDER BY obraid");
while($query_data = mysql_fetch_row($result)) {
echo "$query_data[0]" . "\r\n";
echo "<font size=2>";
echo "<a href=remover_obra.php?id=$query_data[0]>Remover</a><br>";
echo "</font size=2>";
}
}
else{
$result = mysql_query("SELECT obraid FROM obras ORDER BY obraid");
while($query_data = mysql_fetch_row($result)) {
echo "$query_data[0]" . "\r\n";
echo "<font size=2>";
echo "<a href=remover_obra.php?id=$query_data[0]>Remover</a><br>";
echo "</font size=2>";
}
}
[/B]