HI there,
I have built a cool database driven site. I have solved the problems along the way with hard work research and forum posts.
This one has me.
It is something simple I think but I can't seem to figure it out.

My page has a form to search the dynamic drop downs, that was tough to get but cool! So, the php script flawlessly returns the proper xml from the mysql database...
Problem is the page the form is on will not show the results.
I have the same script loading the page initially with dynamic data. It seems to just ignore the search selections when I expect it to reload the page with the new info.
The search selections stay in the selection when I make the form action 'getal1.php' that is the script alone.
Here is my code for both.
I am stumped! Any direction would be a huge help!!!!
This is first part of form page.
Code:
<?php 
$con = mysql_connect('1', 'w', 'p');
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db("wi");
$cate = @mysql_query("Select distinct category FROM cats");
if(!$cate) {
exit('<p>Unable to get category list.</p>');
}
$ct= @mysql_query("select distinct city from referrals where st='AL'");
if(!$ct) {
exit('<p>Unable to get list of cities</p>');
}
$reg=@mysql_query("select distinct region from referrals where st='AL'");
if(!$reg) {
exit('<p>Unable to get list of regions</p>');
}
?>
Here is form code.
Code:
  <td height="173" valign="middle"><form id="search" name="search" method="post" action="/USA/States/AL/getal1.php">
      <table width="100%" border="0">
        <tr>
          <td width="44%"><label class="style44">Category :</label></td>
          <td width="56%"><select name="cat" id="cid">
            <option value="0" selected="selected">All</option>
            <?php
			while($cat= mysql_fetch_array($cate)) {
			$cid= $cat['category'];
			$cname =htmlspecialchars($cat['category']);
			echo "<option value ='$cid'>$cname</option>\n";
			}
			?>
          </select></td>
        </tr>
        <tr>
          <td><label class="style44"><span class="style51">Region:</span></label></td>
          <td><select name="region" id="rid">
            <option value="0" selected="selected">All</option>
            <?php
			while($region= mysql_fetch_array($reg)) {
			$rid=$region['region'];
			$rname= htmlspecialchars($region['region']);
			echo "<option value = '$rid'>$rname</option>\n";
			}
			?>
          </select></td>
        </tr>
        <tr>
          <td><label class="style44"><span class="style50">City: </span></label></td>
          <td><span class="style50">
            <select name="city" id="ctid">
              <option value="0" selected="selected">All</option>
              <?php
		  while($city = mysql_fetch_array($ct)) {
		  $ctid= $city['city'];
		  $ctname = htmlspecialchars($city['city']);
		  echo "<option value = '$ctid'>$ctname</option>\n";
		  }
		  ?>
            </select>
This is the php script that returns search fine as xml output. Won't run the search prior to loading the page though. It's like it ignores the whole search part after the submit is clicked.
Code:
<?php

header("Content-type: text/xml" ); 


$con = mysql_connect('1', 'w', 'p');
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db("wi"); 


$sql="
SELECT * 
FROM referrals 
WHERE st='AL'
AND ver='Y'
"; 

  //the form was submitted
  $cid = $_POST['cat'];
if($cid != '0') {// Category is selected
$sql .= 
"AND cat = '$cid'";
}

$rid = $_POST['region'];
if($rid != '0') { // Region is selected
$sql .=
"AND region ='$rid'";
}

$ctid = $_POST['city'];
if($ctid != '0') { // City is selected
$sql .=
"AND city = '$ctid'";
}

  




$result = mysql_query($sql);





$xml_output = "<?xml version=\"1.0\"?>\n"; 
$xml_output .= "<w>\n"; 

for($x = 0 ; $x < mysql_num_rows($result) ; $x++){ 
$row = mysql_fetch_assoc($result); 
$xml_output .= "\t<r>\n";
	
		 // Escaping illegal characters 
        $row['city'] = str_replace("&", "&", $row['city']); 
        $row['city'] = str_replace("<", "<", $row['city']); 
        $row['city'] = str_replace(">", "&gt;", $row['city']); 
        $row['city'] = str_replace("\"", "&quot;", $row['city']);
		
	$xml_output .= "\t\t<city>" . $row['city'] . "</city>\n";
	
		 // Escaping illegal characters 
        $row['cat'] = str_replace("&", "&", $row['cat']); 
        $row['cat'] = str_replace("<", "<", $row['cat']); 
        $row['cat'] = str_replace(">", "&gt;", $row['cat']); 
        $row['cat'] = str_replace("\"", "&quot;", $row['cat']);


$xml_output .= "\t</r>\n"; 
} 

$xml_output .= "</w>"; 
echo $xml_output;



mysql_close($con);
?>
Please help. I obviously am not getting something!!!