试图让我的$ code == $ code_check工作,但它一直收到我的错误信息?

what should I do to make this code work, I tried to move some of the code to see if that was the problem but its not. also is there a sort way to write this code, thanks.

$new = $_GET['new'];
$id = '';
$ip1 = '';
$ip2 = '';
$upass = '';
$upass2 = '';
$code = '';
$date = '';
echo $new;
if (isset($_POST['upass'])){
$ip1 = $_SERVER['REMOTE_ADDR'];
$upass = $_POST['upass'];
$upass2 = $_POST['upass2'];
$code = $_POST['code'];
$id = $_POST['id'];
$date = date("Y-m-d");
$upass = stripslashes($upass);
$upass2 = stripslashes($upass2);
$upass = strip_tags($upass);
$upass2 = strip_tags($upass2);
if(isset($_POST["submit"])){
        $upass = $_POST['upass'];
        $upass2 = $_POST['upass2'];
        $code = $_POST['code'];
        include_once "includes/connect_pass.php";
        $sql_code = mysql_query("SELECT * FROM user_info WHERE Fuid='$id'"); 
            while($row = mysql_fetch_array($sql_code)){
            $code_check = $row['code'];
            $code2 = $code_check;
            $code = $_POST['code'];
            if ($upass == ""){
            $errormsg = "Oops! Password is empty! Try again. ";
            Print $errormsg;
        }else if ($upass2 == ""){
            $errormsg = 'Oops! Re-Password is empty! Try again. ';
            Print $errormsg;
        }else if ($code = ""){
            $errormsg = 'Oops! code is empty! Try again. ';
            Print $errormsg;
        }else if ($upass !== $upass2){
            $errormsg = 'Oops! both Passwords did not match! Try again. ';
            Print $errormsg;
        }else if ($code !== $code2){
            $errormsg = 'Wrong code';
            $code = $_POST['code'];
            Print $errormsg;
            exit();
        }else{
            if ($id == true){
            include_once "includes/connect_pass.php";
            $sql = mysql_query("UPDATE user_info SET user_password='$upass' where Fuid='$id'");
            }else {
                $errormsg = "oops!!";
                echo $errormsg;