• my code is here, i tried many types of code,need help to redirect on new page, you can see echo message in the bottom of this code…

    <?php
    /*
    *     Popup contact form
    *     Copyright (C) 2011 - 2013 www.gopiplus.com
    *     https://www.gopiplus.com/work/2012/05/18/popup-contact-form-wordpress-plugin/
    */
    
    session_start();
    $PopupContact_abspath = dirname(__FILE__);
    $PopupContact_abspath_1 = str_replace('wp-content/plugins/popup-contact-form', '', $PopupContact_abspath);
    $PopupContact_abspath_1 = str_replace('wp-content\plugins\popup-contact-form', '', $PopupContact_abspath_1);
    require_once($PopupContact_abspath_1 .'wp-config.php');
    
    $PopupContact_name = $_POST['PopupContact_name'];
    $PopupContact_email = $_POST['PopupContact_email'];
    $PopupContact_message = $_POST['PopupContact_message'];
    $PopupContact_On_MyEmail = get_option('PopupContact_On_MyEmail');
    $PopupContact_On_Subject = get_option('PopupContact_On_Subject');
    
    if($PopupContact_On_MyEmail <> "YOUR-EMAIL-ADDRESS-TO-RECEIVE-MAILS" && $PopupContact_On_MyEmail <> "")
    {
    	$sender_email = mysql_real_escape_string(trim($PopupContact_email));
    	$sender_name = mysql_real_escape_string(trim($PopupContact_name));
    	$subject = $PopupContact_On_Subject;
    	$message = $PopupContact_message;				
    
    	$message = preg_replace('|&[^a][^m][^p].{0,3};|', '', $message);
    	$message = preg_replace('|&|', '&', $message);
    	$mailtext = wordwrap(strip_tags($message), 80, "\n");
    
    	$headers = "MIME-Version: 1.0" . "\r\n";
    	$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
    	$headers .= "From: \"$sender_name\" <$sender_email>\n";
    	$headers .= "Return-Path: <" . mysql_real_escape_string(trim($PopupContact_email)) . ">\n";
    	$headers .= "Reply-To: \"" . mysql_real_escape_string(trim($PopupContact_name)) . "\" <" . mysql_real_escape_string(trim($PopupContact_email)) . ">\n";
    	$mailtext = str_replace("\r\n", "", $mailtext);
    	@wp_mail($PopupContact_On_MyEmail, $subject, $mailtext, $headers);
    }
    
    echo "Message bien envoyé.";
    ?>

    [Please post code or markup between backticks or use the code button. Or better still – use a pastebin. Your posted code may now have been permanently damaged/corrupted by the forum’s parser.]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    You cannot redirect with PHP once any page content has been sent. The only option then is to capture an event with javascript, such as clicking an ‘OK’ button, then having javascript simply request the next page. It’s not really a redirect anymore, but the effect is the same.

    Thread Starter Pankaj K Thakur

    (@pankaj_vnt)

    can u send me javascript code and tell me where to put
    thanks… bcoz i want to include google analytics in this page, that’s why i want to redirect on https://www.tanirikka.com/merci/ to know visitors.

    Moderator bcworkz

    (@bcworkz)

    Off the top of my head and untested, so will need some work, the html/javascript is roughly
    <form action="#"><input type="submit" value="OK" onclick="javascript:window.location = 'https://www.tanirikka.com/merci/';"></form>

    I hope that’s close enough to get you in the right direction.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘WordPress redirect on thank you page after submit’ is closed to new replies.