简体   繁体   中英

Contact form not redirecting correctly at submit

I've got a contact form that you reach by pressing the phone and then contact form on the screen. Feel free to test mail me through it, no problem. When I press submit I get redirected to submit and the contact form is gone as well.

I'm trying to achieve something along the lines of redirecting to http://developed-web.com/404.php for now, just to confirm a working redirect. Where do I decide this?

The code

if(isset($_POST['submitted']))
{
   if($formproc->ProcessForm())
   {
        $formproc->_redirect("http://developed-web.com/404.php");
   }
}

doesn't seem to do anything.

EDIT:

I'm also including a file that contains

function RedirectToURL($url)
{
    header("Location: $url");
    exit;
}

Is it relevant?

You will not be able to redirect a page if the headers have already been passed. In order to redirect use

ob_start() at the beginning of the code to "withhold" the headers

and then ob_end_flush() at the end of the code to send the headers, and then you will be able to redirect the page.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM