<?php

// connect to database
include("inc/connect.php");

// include auth and nav
//include("inc/auth.php");

// begin content
//include("inc/nav.php");

// close mysql connection
//mysql_close(); 

// Check if the form has been submitted.
if (isset($_POST['Submit'])) {

	$brandC = $_POST['brandC'];
	$typeC = $_POST['typeC'];
	$styleC = $_POST['styleC'];
	$frameC = $_POST['frameC'];
	$groupSetC = $_POST['groupSetC'];
		
	$errors = array(); // Initialize error array.
	
	//If they did not enter a search term we give them an error
	if (($brandC == "") AND ($typeC == "") AND ($styleC == "All") AND ($frameC == "") AND ($groupSetC == ""))
	{
	$errors[] = 'You did not select anything.';
	}
	
	//If user only enter Bicycle Brand
	elseif (($brandC!="") AND ($typeC=="") AND ($styleC== "All") AND ($frameC== "") AND ($groupSetC== ""))
	{
	$result = mysql_query("SELECT * FROM cycles WHERE brand='$brandC'");
	}

	//If user only enter Bicycle Type
	elseif (($brandC="") AND ($typeC!=="") AND ($styleC== "All") AND ($frameC== "") AND ($groupSetC== ""))
	{
	$result = mysql_query("SELECT * FROM cycles WHERE type='$typeC'");
	}
	
	//If user only enter Bicycle Frame
	elseif (($brandC="") AND ($typeC=="") AND ($styleC == "All") AND ($frameC!== "") AND ($groupSetC== ""))
	{
	$result = mysql_query("SELECT * FROM cycles WHERE frame='$frameC'");
	}
	
	//If user only enter Bicycle GroupSet
	elseif (($brandC="") AND ($typeC=="") AND ($styleC== "All") AND ($frameC== "") AND ($groupSetC!== ""))
	{
	$result = mysql_query("SELECT * FROM cycles WHERE groupSet='$groupSetC'");
	}
	
	if (empty($errors)) { // If everything's OK.
	
		echo "<table border=1 style='color:blue'>";
		echo "<tr>" ;
		echo "<td align=center style='color:red'>CID</td>";
		echo "<td align=center style='color:green'>Brand</td>";
		echo "<td align=center style='color:red'>Type</td>";
		echo "<td align=center style='color:green'>Style</td>";
		echo "<td align=center style='color:red'>Model</td>";
		echo "<td align=center style='color:green'>Gear No</td>";
		echo "<td align=center style='color:red'>Frame</td>";
		echo "<td align=center style='color:green'>Group Set</td>";
		echo "<td align=center style='color:red'>Price</td>";
		echo "<td align=center style='color:green'>Release Date</td>";
		echo "</tr>";
		
		while($row = mysql_fetch_array($result))
		{
			echo "<tr>" ;
			echo "<td align=center>".$row['cycleID'] ."</td>";
			echo "<td align=center>".$row['brand']."</td>";
			echo "<td align=center>".$row['type']."</td>";
			echo "<td align=center>".$row['style']."</td>";
			echo "<td align=center>".$row['model'] ."</td>";
			echo "<td align=center>".$row['gearNo']."</td>";
			echo "<td align=center>".$row['frame']."</td>";
			echo "<td align=center>".$row['groupSet']."</td>";
			echo "<td align=center>".$row['price']."</td>";
			echo "<td align=center>".$row['releaseDate']."</td>";
			echo "</tr>";
		}
	echo "</table>";
		
	exit();
				
	} // End of if (empty($errors)) IF.
	
	mysql_close(); // Close the database connection.
		
} // End of the main Submit conditional.

if (!empty($errors)) { // Print any error messages.
	echo "<h1 style='font-family:Calibri; color:red; text-align:center'>Error!</h1>
	<p style='font-family:Calibri; color:#0066FF; text-align:center'>The following <span style='color:red'>error(s)</span> occurred:</p>";
	foreach ($errors as $msg) { // Print each error.
		echo " <h5 style='font-family:Calibri; color:orange; text-align:center'> - $msg</h5>\n";
	}
	//echo '</p><p>Please try again.</p>';
	
	echo "<h4 style='font-family:Calibri; color:green; text-align:center'>Please try again....</h4>

	<br>
	<p style='font-family:Calibri; color:#0066FF; text-align:center'>You will now be returned to the find Cycle page again. <span style='color:red'>Please follow the rules!</span></p>

	<META HTTP-EQUIV=\"refresh\" content=\"3; URL=findlist.php\"> ";
}
// Create the form.
?>

Only the 1st and the 2nd condition working rest not working.

error msg:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in D:\xampp\htdocs\cycle\find.php on line 72.

use $result = mysql_query($sql) or die (mysql_error());

if you have an error in your query it won't be executed and this is why you get that message.

#
//If user only enter Bicycle Type
#
elseif (($brandC="") AND ($typeC!=="") AND ($styleC== "All") AND ($frameC== "") AND ($groupSetC== ""))

I do this occasionally. You are confusing the comparison operators. On line 39, where you have $brandC="", you're not comparing the string to empty, you're resetting the value to empty. If you want to check if empty, use $brandC =="". Also, $typeC !=="" should be $typeC !="". There are also similar problems on line 45 & 51.
Or better yet, use

elseif(empty($brandC) && !empty($typeC) && empty($frameC) && empty($groupSetC))

I could be wrong, but, I believe it will parse a bit faster.

This question has already been answered. Start a new discussion instead.