从提交表单重定向到PHP中的感谢页面

时间:2014-06-05 18:44:10

标签: php

我正在从recaptcha更改为蜜罐,以避免在我的网站上发送垃圾邮件。 www.dentistheadhunter.com。我正在使用www.dentistheadhunter.com/indexpot.php进行试运行,当我提交表单时,流程表单正在输入我的数据库并向我发送电子邮件,但谢谢表单重定向无法正常工作流程表单(http://www.dentistheadhunter.com/resumefrontpot2.php)只是以空白页结尾,而不是重定向到我的thank_you.php页面。

我已经阅读了之前的问题并在启动php标记之前删除了任何空白区域并且没有解决问题。

这是我的代码

<?php
require("includes/dbconnect/mob_db.php");
$robotest = $_POST['robotest'];
if($robotest)
echo "Thank you for your inquiry Robot.";
$cand_sql = 'INSERT INTO dent_leads (first_name,last_name,disc_id,city,state,zip,area_code,phone,email,location,setting,experience,timestamp,source,notes,resume_path) VALUES ("' . $_POST['first_name'] . '","' . $_POST['last_name'] . '","' . $_POST['disc'] . '","' . $_POST['city'] . '","' . $_POST['state'] . '","' . $_POST['zip'] . '","' . $_POST['area_code'] . '","' . $_POST['phone1'] . $_POST['phone2'] . '","' . $_POST['email'] .  '","' . $_POST['location'] . '","' . $_POST['setting'] .'","' . $_POST['experience'] .'","' . time() . '","DentistHeadHunterFP.com","' . $_POST['comments'] . '","' . $target_path .'")';
$cand_res = mysql_query($cand_sql,$leads_db);
if(is_array($_POST['license'])){
    foreach($_POST['license'] as $lic_state){
        if($lic_state != ''){
            $licensed .= ',("' . $dent_id . '","' . $lic_state . '")';
        }
    }
    if(isset($licensed)){
        $lic_sql = 'INSERT INTO dent_lic (dent_id,state) VALUES ' . ltrim($licensed,',');
        $lic_res = mysql_query($lic_sql,$leads_db);
    }
} 

$msg  .= 'Name: ' . $_POST['first_name'] . ' ' . $_POST['last_name'] . '<br />' . "\r\n";
    $msg  .= 'Discipline: ' . $_POST['disc']  . '<br />' . "\r\n";
    $msg  .= 'City: ' . $_POST['city']  . '<br />' . "\r\n";
    $msg  .= 'State: ' . $_POST['state']  . '<br />' . "\r\n";
    $msg  .= 'Zip: ' . $_POST['zip']  . '<br />' . "\r\n";
    $msg  .= 'Phone: ' . $_POST['area_code'] . '-' . $_POST['phone1'] . '-' . $_POST['phone2'] . '<br />' . "\r\n";
    $msg  .= 'Email: ' . $_POST['email'] . '<br />' . "\r\n";
    $msg  .= 'Experience: ' . $_POST['experience'] . '<br />' . "\r\n";
    $msg  .= 'Lead Source: First page ' . $_POST[''] . '<br />' . "\r\n";
    $msg  .= 'Settings: ' . $_POST['setting']  . '<br />' . "\r\n";
    $msg  .= ' ' . $_POST['']  . '<br />' . "\r\n";
    $msg  .= 'Location: ' . $_POST['location']  . '<br />' . "\r\n";
    $msg  .= ' ' . $_POST['']  . '<br />' . "\r\n";
    $msg  .= 'First Page Comments: ' . $_POST['comments'] . '<br />' . "\r\n";

    $headers  = 'MIME-Version: 1.0' . "\r\n";
    $headers  .= 'Return-Path: <dentistjobs@dentistheadhunter.com> ' . "\r\n";
    $headers  .= 'From: Dentist Head Hunter Candidate <dentistjobs@dentistheadhunter.com> ' . "\r\n";
    $headers  .= 'Reply-To: Dentist Head Hunter Candidate <dentistjobs@dentistheadhunter.com> ' . "\r\n";
    $headers  .= 'Bcc: Dentist Head Hunter Candidate <dentistjobs@dentistheadhunter.com> ' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    mail('dentistjobs@dentistheadhunter.com','NEW HEADHUNTER LEAD',$msg,$headers);
    header( 'Location: http://www.dentistheadhunter.com/thank_you.php' ) ;

&GT;

1 个答案:

答案 0 :(得分:0)

echo

之前,您似乎是header()消息

如果您想回复该消息,请写

ob_start();
echo "Thank you for your inquiry Robot.";
header('Location:http://www.dentistheadhunter.com/thank_you.php');
ob_end_flush();