<?php


    if(isset($_POST['tracking']))
    {
        if($_POST['tracking']!="")
        {
            /*connexion a la BDD*/
			$db=mysql_connect("localhost", "sakado_is", "60803144_ME");
            mysql_select_db('sakado_if',$db);
            $answer =mysql_query("SELECT * FROM clients WHERE Tracking_No='" . $_POST['tracking'] . "'") or die(mysql_error());
            $row = mysql_fetch_assoc($answer);
            $numrows = mysql_num_rows($answer);
			if($numrows == 1) 
			{   header('Location: client_view.php?tracking='. $_POST['tracking'] .'');
				
			}
			else 
			{   
				header('Location: track_error.php');
			}          
        }
        else
        {
           echo "The tracking field must be filled!"; 
        }
    }
    else
    {
        echo "ERROR ABOUT VARIABLE CREATION";
    }
?>