Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5839455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:35:12+00:00 2026-05-22T11:35:12+00:00

All, I have few html pages in my application which is on WAMP. I

  • 0

All,

I have few html pages in my application which is on WAMP.

I needed an login page which on successful login would redirect the user to the other page in the application.

I am:

1> Not able to redirect. I have define the header('Location: /X/Y/abc.html'). This is the relative path from the wamp home i.e. C:\wamp\www\. I think there is a issue with the path being mentioned here.

2> On unsuccessful login, the user should be redirect to the same page. When I tried that using header('Location: '.$_SERVER['PHP_SELF']). Trying to execute the code gives me

So I have 2 folders essentially:

Folder Z contains the following HTML code named index.html and abc.php
Folder /X/Y/ contains the actual application for which the authentication is set.

HTML Code:

<html>
   <head>
      <title>
         Login
      </title>
   </head>
   <body>
      <form action="/Z/abc.php" method="post">
         <table id="input">
         <tr>
               <td>Admin Username <input type="text" name="username"></td>
         </tr>
         <tr>
               <td>Password <input type="text" name="passwd"></td>
         </tr>
         <tr>
               <td><input type = "submit" id="submitButton"></td>
         </tr>
      </form>
   </body>
</html>

PHP Code:

<?php 
   $username="ab";
   $password="cd";

   if (isset($_POST["username"]) && strcasecmp($username, $_POST["username"]))
   {
      header('Location: /X/Y/navigation.html');
   }
?>

Executing the code doesn’t redirect me to the navigation.html but stops at abc.php i.e. the URL remaind: http://localhost:81/Z/validate.php

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T11:35:13+00:00Added an answer on May 22, 2026 at 11:35 am

    You’d need to make your abc.php redirect back to the login page if the login isn’t successful:

    abc.php:

    <?php
    
    $username = 'ab';
    $password = 'cd';
    
    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
       if ((isset($_POST['username']) && ($_POST['username'] == $username)) &&
          (isset($_POST['password']) && ($_POST['password'] == $password))) {
             header("Location: /X/Y/navigation.html");
             exit();
       }
    }
    
    header("Location: login.html");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an HTML table containing a few rows (this is built dynamically). All
I have a few separate applications which are all launched purely through a main
I have a page with a few links that are all like this: <a
I will have a web-application which will use a few complex forms. One form
I'm new to ASP.NET but have quite a few successful test pages going now
I have a few different contact forms in my CakePHP 2.0 application. All of
I have a HTML page that displays a few values. I also have a
I have few thousands HTML sources to read. It is from forum which started
We have few downloaded HTML pages, with broken links (relative paths), and we have
First of all i have to clear few things 1.This is not spam group

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.