www.webdeveloper.com
Results 1 to 2 of 2

Thread: Throwing internal server error when header is changed

  1. #1
    Join Date
    Jun 2009
    Posts
    20

    Throwing internal server error when header is changed

    Hello,

    I am using this script:

    <?php
    $answer = $_REQUEST['answer'] ;

    $correctanswer = "ANSWER";

    $lasttaskloc = "http://www.example.com/wrong/";

    $nexttaskloc = "http://www.example.com/right";

    if (answer == correctanswer) {
    header(nexttaskloc);
    } else {
    header(lasttaskloc);
    }

    ?>

    However, when I run this, the page shows a 500 internal server error.

    I checked my server logs and I got this error:

    [Fri Aug 28 20:23:44 2009] [error] [client 86.161.50.191] FastCGI: comm with server "/var/www/fcgi/php-cgi" aborted: error parsing headers: malformed header 'lasttaskloc'

    Any one know how to fix this?

    Thank you very much for your help,

    Sam

  2. #2
    Join Date
    Jan 2009
    Posts
    3,346
    The "header" function in php sends new header information to the browser. If you are trying to change the "Location: " header you will need to include that in the function call:
    PHP Code:
    header("Location: your_location_here"); 
    php.net/header

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles