Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

ERROR: localhost redirected you too many times USING PHP

Good morning, I’m a beginner in PHP. I’m developing an evaluation system for teacher and I have encountered this problem.

This page isn’t working localhost redirected you too many times. Try clearing your cookies. ERR_TOO_MANY_REDIRECTS

MY CODE:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

<?php 

////DATABASE CONNECTION HERE!
session_start();

include("connection.php");
include("functions.php");
    
    
    //CHECKING THE BUTTON IF IS IT CLICK!
    
        if(isset($_POST['submit'])){
            if(!empty(['submit'])){
                if(!empty(['statement'])){
                    
                    $statement1 = $_POST['statement1'];
                    $statement2 = $_POST['statement2'];
                    $statement3 = $_POST['statement3'];
                    $statement4 = $_POST['statement4'];
                    $statement5 = $_POST['statement5'];
                    $statement6 = $_POST['statement6'];
                    
                    $result=mysqli_query($mysqli, "INSERT INTO results VALUES('','$statement1', '$statement2', '$statement3', '$statement4', '$statement5', '$statement6')");
    
                    if($result){
                        echo'<script type="text/javascript"> alert("YOUR RESPONSE HAS BEEN SUBMITTED. THANK YOU!") </script>';
                        
                    }
                }
                else{ 
                    echo'<script type="text/javascript"> alert("SUBMIT YOUR RESPONSE") </script>';
                    }
            }       
            else{
                echo'<script type="text/javascript"> alert(" PLEASE CLICK ONE RADIO BUTTON PER QUESTIONS! </script>';
                }
        }   
    header("Location: evaluation.php");
    die;
                                    

?>

>Solution :

  • header() function returns error like ERR_TOO_MANY_REDIRECTS that change page name.php to some url like below.
header("Location: /index.php"); 

Or

header("Location: ./index.php"); 

Or

header("Location: ..application/index.php"); 
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading