[Solved] php redirect_to() function undefined


You have to define the redirect_to function before calling it. Try this code

    <?php
        if($result){
            $num_rows = mysqli_num_rows($result);
            if($num_rows == 1){
                $found_user=mysqli_fetch_array($result);
                redirect_to("main.php");
            }
            else{
                redirect_to("index.php");
            }
        }
        function redirect_to($location){
            header('Location:'.$location);
        }
?>

solved php redirect_to() function undefined