I am trying to query my database by simply sending information from a form i have created, whils I am getting no errors unfortunately I am getting no results.
Anyone tell me where I am going wrong please ?
The code is as follows
FORM:
<form action="http://MYDOMAIN.COM/carbon_search.php" method="post">
<br>
<select name="carbon_max">
<option selected>Max Carbon (%)</option>
<option value="1">0.02</option>
<option value=2>0.04</option>
<option value=3>0.06</option>
<option value=4>0.08</option>
<option value=5>0.10</option>
<option value=6>0.12</option>
<option value=7>0.14</option>
<option value=8>0.16</option>
<option value=9>0.18</option>
<option value=10>0.20</option>
<option value=11>0.25</option>
</select>
<input type="submit" value="Go!!" name="Go">
</form>
PHP SEARCH SCRIPT:
<? $hostname = "MY HOSTNAME";
$username = "MY USERNAME";
$password = "MY PASSWORD";
$usertable = "chemical";
$dbName = "db72325051";
MYSQL_CONNECT($hostname, $username, $password) OR DIE("DB connection unavailable");
@mysql_select_db( "$dbName") or die( "Unable to select database");
?>
<?
//error message (not found message)begins
$XX = "";
// main code
if($POST['carbon_max'] == 1)
$where1 = 'carbon_max <= 0.020';
if($POST['carbon_max'] == 2)
$where1 = 'carbon_max <= 0.040';
if($POST['carbon_max'] == 3)
$where1 = 'carbon_max <= 0.060';
if($POST['carbon_max'] == 4)
$where1 = 'carbon_max <= 0.080';
if($POST['carbon_max'] == 5)
$where1 = 'carbon_max <= 0.100';
if($POST['carbon_max'] == 6)
$where1 = 'carbon_max <= 0.120';
if($POST['carbon_max'] == 7)
$where1 = 'carbon_max <= 0.14';
if($POST['carbon_max'] == 8)
$where1 = 'carbon_max <= 0.160';
if($POST['carbon_max'] == 9)
$where1 = 'carbon_max <= 0.180';
if($POST['carbon_max'] == 10)
$where1 = 'carbon_max <= 0.200';
if($_POST['carbon_max'] == 11)
$where1 = 'carbon_max <= 0.250';
//query
$query = mysql_query("SELECT alloy, carbon_max, link FROM chemical WHERE 'carbon_max'=$where1");
while ($row = @mysql_fetch_array($query))
{
$variable2=$row["alloy"];
$variable3=$row["carbon_max"];
$variable4=$row["link"];
//table layout for results
print ("<tr>");
print ("<td>$variable2</td>");
print ("<td>$variable3</td>");
print ("<td>$variable4</td>");
print ("</tr>");
}
//below this is the function for no record!!
if (!$variable1)
{
print ("$XX");
}
//end
?>
Any input would be greatly appreciated