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 7777775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T18:13:43+00:00 2026-06-01T18:13:43+00:00

I have a problem where I need to redirect to another page and pass

  • 0

I have a problem where I need to redirect to another page and pass a value, which is easy and I know how to do, except that theres the old header problem: Cannot modify header information – headers already sent by … line 17

<?php include('m_a2_functions.php'); ?>
<?php global_header(LOGIN); ?>
<?php login(); ?>
<?php 
if(isset($_POST['submit']))
{
    connect();
    $username = $_POST['username'];
    $password = $_POST['password'];

    $query = "SELECT password from users where username = '$username'";
    $result = mysql_query($query) or die ("There was an error executing the query $query:<br/>".mysql_error());
    $row = mysql_fetch_array($result);
    $encrypted_pass = $row[0];

    if (crypt($password, $encrypted_pass) == $encrypted_pass) {
        $flag = "y";
        header('Location: m_a2_view.php?flag=y');
    }

}
?>
<?php validation(); ?>
<?php page_footer(); ?>

This is all fine, except that there is a problem with the header part. It won’t redirect.

GLOBAL HEADER FUNCTION IN FUNCTIONS.PHP

<?php function global_header($page_title){ ?>
<?php echo '<?xml version="1.0" encoding="UTF-8"?>'; ?> <- LINE 17
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
    <head>
        <title><?php echo "MARK - " . $page_title; ?></title>
        <link rel="stylesheet" href="style.css" />
    </head> 
    <body>
    <div id="container">
    <div id="logo"></div>
<?php } ?>

LINE 17

<?php echo '<?xml version="1.0" encoding="UTF-8"?>'; ?>

I know that’s what is causing it. It loads global_header at the start of my page and then can’t redirect to another page. Soon as I hit submit, my page should redirect, but it cannot!

Even if I start removing things, it won’t work. It will EVENTUALLY work after getting rid of global_header() completely, something which I can’t do.

  • 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-06-01T18:13:44+00:00Added an answer on June 1, 2026 at 6:13 pm

    The reason you are having this issue is because your script is multiple open <?php and closing ?> of PHP tag which has space and new line between them …

    Replace

    <?php include('m_a2_functions.php'); ?>
    <?php global_header(LOGIN); ?>
    <?php login(); ?>
    <?php 
    

    With

    <?php 
    include('m_a2_functions.php');
    //global_header(LOGIN);
    //login(); 
    

    Your Script

        include ('m_a2_functions.php');
        if (isset ( $_POST ['submit'] )) {
            connect ();
            $username = $_POST ['username'];
            $password = $_POST ['password'];
    
            $query = "SELECT password from users where username = '$username'";
            $result = mysql_query ( $query ) or die ( "There was an error executing the query $query:<br/>" . mysql_error () );
            $row = mysql_fetch_array ( $result );
            $encrypted_pass = $row [0];
    
            if (crypt ( $password, $encrypted_pass ) == $encrypted_pass) {
                $flag = "y";
                header ( 'Location: m_a2_view.php?flag=y' );
            }
    
        } else {
            echo global_header ( "LOGIN" );
            login ();
        }
    
        validation ();
        page_footer ();
    
        function global_header($page_title) {
            $content = '<?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
        <head>
            <title><?php echo "MARK - ' . $page_title . '</title>
            <link rel="stylesheet" href="style.css" />
        </head> 
        <body>
        <div id="container">
        <div id="logo"></div>';
    
            return $content;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple page that I need to execute some GWO & GATC
Greetings, Here's the problem I'm having. I have a page which redirects directly to
I have an action which I need to post forward onto another action if
For my application, I have a page that redirects to another page (within the
I have problem i need to convert from my Array structure to std::vector<int> ...
I have the following problem: We need to find the next august. I other
I have a problem where I need to remove all code and triggers from
I have the following problem: I need to use XSLFO to generate a 2-column
I have the next problem: I need to process only 1 request at a
OSX 10.7, XCode 4. I have a small problem: I need to push back

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.