www.webdeveloper.com
Results 1 to 2 of 2

Thread: Page with multiple forms not redirecting to page

  1. #1
    Join Date
    Aug 2012
    Posts
    1

    Question Page with multiple forms not redirecting to page

    Good afternoon:

    I am fairly new to php so I'm not sure how to word this question. I am building a clearance form for our hr department which involves around 13 departments. I have written most of the code; however, I am having problems with the approval page. I have multiple forms each named differently with different submit buttons. Only one form per department is displayed based on the approver's department code. After the form is validated and submitted, the user should be redirected to thankyou.html page. This does not happens and the form disappears but the page remains. Any advice. The code for each form is basically the same. The code for one of the forms is below:

    if($deptid==2)
    {
    if($submithroffice == "yes")
    {
    //VALIDATION-------------------------------------------------------------

    if(!isset($leavereporting))
    {
    $formfailure = 4;
    }
    elseif((!is_numeric($sick) || !is_numeric($annual)) && $leavereporting == 1)
    {
    $formfailure = 5;
    $Leaveerror = "You must enter a value for leave balance.";
    }

    if($leavereporting == 1 || $leavereporting == 0 && !$modify)
    {
    $updateqry2 = "UPDATE ApprovedItems SET annual = '$annual', sick = '$sick', bank = '$bank' WHERE formID =".$formid;
    $updatedo2 = odbc_do($dbconnect, $updateqry2);
    $sendemail = "leavetopayroll";
    include("sendemail.php");

    //redirect to thank you page
    $url = "http://apps2.nsu.edu/hrclearance/thankyou.html";
    header("Location :".$url);
    exit();
    }

    if(empty($hrrejcmt) && $leavereporting == 2)
    {
    $formfailure = 4;
    }
    if($leavereporting == "2")
    {
    $sendemail = "deptcorrectleave";
    $updateqryerr = "UPDATE ApprovedItems SET hr_rejectcmt = '$hrrejcmt' WHERE formID = ".$formid;
    $updatedoerr = odbc_do($dbconnect, $updateqryerr);
    include("emailcorrection.php");
    }

    if($formfailure == 4)
    {
    print '<div style="text-align:center;font-size:15px;color:#CC0000;font-weight:bolder">You have left a field blank or you have submitted a reject without a rejection comment.</br>'.$errorLeave.'</div>';
    }
    elseif($formfailure == 5)
    {
    print '<div style="text-align:center;font-size:15px;color:#CC0000;font-weight:bolder">You have left a field blank or you have submitted a reject without a rejection comment.</br>'.$Leaveerror.'</div>';
    }
    }
    }

  2. #2
    Join Date
    Jul 2009
    Posts
    184
    Not sure this will work for you, but try throwing ob_start(); just after your files opening <?php tag. Would look like this:
    Code:
    <?php
    ob_start();

Thread Information

Users Browsing this Thread

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

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