lundi 19 mars 2018

XAMPP php redirect to html on C drive

I'm new to web dev, and I'm running into an issue building a site. Unfortunately, I haven't found an answer to this exact problem yet...

I'm using XAMPP to test. I have a HTML page (in a package on my C drive because it is not live yet) - and I'm trying to check if the input of a text box is in a database or not. Once the submit button is clicked, it directs to a php page on the server that successfully executes the query - but here's the problem... I want to direct back to page A if the query is found, and page B if not. Both page A and B have buttons that call other html pages in the package, so I'm trying to redirect back to html pages on my C drive:

    if($nameFound == True) {
    // echo "User Name: " . $userinput . " is in the database!";
    $URL="C://<path to html file>/A.html"; 

    header ("Location: $URL"); 
    exit();
} else {
    // echo "User Name: " . $userinput . " is not in the database!";
    $URL="C://<path to html file>/B.html"; 

    header ("Location: $URL"); 
    exit();
}

This, does not work, however - it tries to find a non-existent php page on the server.

Does anyone know how to achieve this goal? Thanks for the help.




Aucun commentaire:

Enregistrer un commentaire