Am trying to validate these variables with an if statement,but it not working,any help will do.
if($navtype == "xxxx")
{
$com_name = $_POST['com_name'];
$loc = $_POST['loc'];
$name_mech = $_POST['name_mech'];
$vtype = $_POST['vtype'];
$s_veration = $_POST['s_veration'];
$remnder_ver = $_POST['remnder_ver'];
$vreg = $_POST['vreg'];
$last_startdate = $_POST['dy']."-".$_POST['dm']."-".$_POST['dd'];
$mileage = $_POST['mileage'];
$current_mileage = $_POST['current_mileage'];
$cur_date = date("F j, Y, g:i a");
if($s_veration == $remnder_ver)
{
echo" <strong>Specific Variation</strong> ought to have a value equal to <strong>Reminder Variation</strong>, please go back and alter your values";
exit();
}
elseif($s_veration >= $remnder_ver)
{
echo" <strong>Specific Variation</strong> ought to have a value grater than <strong>Reminder Variation</strong>, please go back and alter your values";
exit();
}
else{exit();}
$counter=0;
$query = "select count(*) As counter FROM sre_log WHERE vreg = '$vreg'";
$routes_result = mysql_query($query);
$routes_num = 0;
//$routes_num = mysql_numrows($routes_result);
$routes_num = mysql_num_rows($routes_result);
$i = 0;
//$x = 1
while($i < $routes_num)
{
$counter = mysql_result($routes_result,$i,"counter");
$i++;
}
if ($counter == 0 )
{
$sql = "insert INTO xxx
(com_name, loc, name_mech, vtype, s_veration, remnder_ver, vreg, last_startdate, mileage, current_mileage, cur_date)
values('$com_name','$loc','$name_mech','$vtype','$s_veration','$remnder_ver','$vreg','$last_startdate','$mileage','$current_mileage','$cur_date')";
}else{
$sql = "UPDATE xxx SET
mileage_out='$mileage',mileage_in='$current_mileage',vreg='$vreg',s_veration='$s_veration',remnder_ver='$remnder_ver' WHERE vreg='$vreg'";
}
mysql_query($sql);