Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 13 of 13

Thread: Header Help

  1. #1
    New Coder
    Join Date
    Nov 2006
    Location
    INDIA
    Posts
    94
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Header Help

    Hi All

    I am taking all the user input in one form and submit the data on to another form for processing the data. Once the data is processed i use the below code for redirecting it to another page.

    header("Location: http://www.example.com/folder/mypage.php");

    On development server it works perfect, but on my production its not working.
    What couid be the issue in this? Plz Help me out.


    Thanks
    Shailesh
    -------------------------
    Shailesh Patil
    -------------------------

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Do you have a link to your site? Are you sure your server even supports php?
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    New Coder
    Join Date
    Nov 2006
    Location
    INDIA
    Posts
    94
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by _Aerospace_Eng_ View Post
    Do you have a link to your site? Are you sure your server even supports php?
    Yes. production server supports php. Its an linux FC3.
    This strange situation has arised after 3 years of my php work on same server. All other sites work absolutely fine. its the problem only with this website.
    Any guess what could be the problem?
    -------------------------
    Shailesh Patil
    -------------------------

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Try using a relative url.
    PHP Code:
    header("Location: folder/mypage.php"); 
    If that doesn't work then you need to post a link to your page.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #5
    New Coder
    Join Date
    Nov 2006
    Location
    INDIA
    Posts
    94
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi

    thanks for your time.

    Just tried with ur suggestion, but still the same problem.
    On same server, i am using
    header("Location: folder/mypage.php"); in many of websites. It works.
    The issue is with only this website. After processing the data, an blank page is returned, and redirection do not take place.
    This is the only website i am not being redirected.
    Hence, i am doing redirection through javascript.

    Can you suggest some other alternative.

    thanks in advance
    -------------------------
    Shailesh Patil
    -------------------------

  • #6
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,149
    Thanks
    2
    Thanked 333 Times in 325 Posts
    Some content is likely being output to the browser prior to the header(...) statement. Someone recently had a problem in that the editor being used was inserting characters at the start of the files due to language encoding and they were FTPing the files to the server in binary mode. Perhaps something similar is occurring here.

    Turn on and/or check for any warning messages about output already being sent...

    Perhaps create a new blank file and copy/paste the contents from this file into it and upload the new file to the server making sure that the transfer is in ascii mode and not binary mode.
    Last edited by CFMaBiSmAd; 11-15-2006 at 08:46 AM.
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #7
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Be sure to upload your files using ascii and not binary. Binary will add some weird characters to your files.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #8
    New Coder
    Join Date
    Nov 2006
    Location
    INDIA
    Posts
    94
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi

    Many many thanks for your valuable inputs. i did copy/paste and checked it. didnt worked out.
    I am doing my file upload using file manager (webmin).
    Any Hints?

    Just have a look at this code. This is same piece of code which i m using for inserting and updating the tables.

    Code:
    <?
    include('../include.php');
    if ($action=='save') {
     // get the max id
     $documentid=$db->getMaxID('documentation','documentid',3);
     unset($dict);
     $dict['documentid'] = $db->squote($documentid);
     $dict['type'] = $db->squote($type);
     $dict['documentname'] = $db->squote(strtoupper($documentname));
     $dict['commodityid'] = $db->squote($commodityid);
     $dict['inspections'] = $db->squote($inspectionid);
     $dict['notes'] = $db->squote($notes);
     $db->dbinsert($dict,"documentation");
     header("Location: documentview.php");
     exit();
    }
    // for updating 
    if ($action=='update') {
     unset($dict);
     $dict['type'] = $db->squote($type);
     $dict['documentname'] = $db->squote(strtoupper($documentname));
     $dict['commodityid'] = $db->squote($commodityid);
     $dict['inspections'] = $db->squote($inspectionid);
     $dict['notes'] = $db->squote($notes);
     $db->dbupdate($dict,"documentation", " documentid='$documentid' and companyid='$companyid'");
     header("Location: documentation/documentview.php");
     exit();
    }
    // end for update
    ?>
    <!-- <script>
    location.href="documentview.php";
    </script> -->
    -------------------------
    Shailesh Patil
    -------------------------

  • #9
    Regular Coder
    Join Date
    May 2005
    Posts
    563
    Thanks
    0
    Thanked 3 Times in 3 Posts
    Try remove the exit();

    Sometimes php keeps processing and won't redirect because you called exit which stops everything.

  • #10
    New Coder
    Join Date
    Nov 2006
    Location
    INDIA
    Posts
    94
    Thanks
    0
    Thanked 0 Times in 0 Posts
    No. It still not working.

    Quote Originally Posted by SeeIT Solutions View Post
    Try remove the exit();

    Sometimes php keeps processing and won't redirect because you called exit which stops everything.
    -------------------------
    Shailesh Patil
    -------------------------

  • #11
    Regular Coder
    Join Date
    May 2005
    Posts
    563
    Thanks
    0
    Thanked 3 Times in 3 Posts
    Can you post the code of the entire page? Or at least everything above that part.

  • #12
    New Coder
    Join Date
    Nov 2006
    Location
    INDIA
    Posts
    94
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Its already there in my earlier post.

    Code:
    <? include('../include.php'); if ($action=='save') { // get the max id $documentid=$db->getMaxID('documentation','documentid',3); unset($dict); $dict['documentid'] = $db->squote($documentid); $dict['type'] = $db->squote($type); $dict['documentname'] = $db->squote(strtoupper($documentname)); $dict['commodityid'] = $db->squote($commodityid); $dict['inspections'] = $db->squote($inspectionid); $dict['notes'] = $db->squote($notes); $db->dbinsert($dict,"documentation"); header("Location: documentview.php"); exit(); } // for updating if ($action=='update') { unset($dict); $dict['type'] = $db->squote($type); $dict['documentname'] = $db->squote(strtoupper($documentname)); $dict['commodityid'] = $db->squote($commodityid); $dict['inspections'] = $db->squote($inspectionid); $dict['notes'] = $db->squote($notes); $db->dbupdate($dict,"documentation", " documentid='$documentid' and companyid='$companyid'"); header("Location: documentation/documentview.php"); exit(); } // end for update ?> <!-- <script> location.href="documentview.php"; </script> -->
    -------------------------
    Shailesh Patil
    -------------------------

  • #13
    Regular Coder
    Join Date
    May 2005
    Posts
    563
    Thanks
    0
    Thanked 3 Times in 3 Posts
    Could you give a link to this page?


  •  

    Posting Permissions

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