3 posts
  • Bought between 10 and 49 items
  • Has been a member for 2-3 years
dbruzzese84 says

I have downloaded a theme here on themeforest but get no repsonse for support from developers. I was wondering if anyone here can help. I would like to redirect upon form submission. I tried everything the internet directed me to believe me.. still nothing works. Any php experts? Here is my code below.

<?php if(isset($_POST[‘name’]) && isset($_POST[‘email’]) && isset($_POST[‘message’])) {

//Insert your email address
$mailTo = "davebruzzese@gmail.com";
//Insert the default subject of the email
$defaultSubject = "Benefits of an Automated Time Clock Solution-Landing Page";
(isset( $_POST['subject'] ) ) ? $subject = $_POST['subject'] : $subject = $defaultSubject;
$name = htmlspecialchars(urldecode($_POST['name']));
$mailFrom = htmlspecialchars(urldecode($_POST['email']));
$message_text = htmlspecialchars($_POST['message']);
$headers = 'Content-type: text/html; charset=UTF-8' . "\r\n";
$headers .= 'From: '.$mailFrom;
$message =  " 
                <head>
                    <title> $subject </title>
                </head>
Benefits of an Automated Time Clock Solution - Landing Page    
Name/Company name: $name

E-mail: $mailFrom

";
$message .=       "Message:

$message_text

";

if (mail($mailTo, $subject, $message, $headers)) header(“Location: www.google.com”); else { echo “Some errors occurred, try again.”; }

} ?>

THANKS!!! ANY HELP GREATLY APPRECIATED

3192 posts
  • Sold between 5 000 and 10 000 dollars
  • United States
  • Bought between 10 and 49 items
  • Has been a member for 4-5 years
  • Exclusive Author
organicbee says
fixing his code formatting

<?php
if(isset($_POST['name']) && isset($_POST['email']) && isset($_POST['message']))
{

    //Insert your email address
    $mailTo = "davebruzzese@gmail.com";
    //Insert the default subject of the email
    $defaultSubject = "Benefits of an Automated Time Clock Solution-Landing Page";

    (isset( $_POST['subject'] ) ) ? $subject = $_POST['subject'] : $subject = $defaultSubject;
    $name = htmlspecialchars(urldecode($_POST['name']));
    $mailFrom = htmlspecialchars(urldecode($_POST['email']));
    $message_text = htmlspecialchars($_POST['message']);

    $headers = 'Content-type: text/html; charset=UTF-8' . "\r\n";
    $headers .= 'From: '.$mailFrom;

    $message =  " 
                    <head>
                        <title> $subject </title>
                    </head>

                Benefits of an Automated Time Clock Solution - Landing Page    <br />
                <b>Name/Company name:</b> $name<br /><br />
                    <b>E-mail:</b> $mailFrom<br /><br />";

    $message .=       "<b>Message:</b><br />
                    <p>$message_text</p>

                ";

if (mail($mailTo, $subject, $message, $headers)) 
            header("Location: www.google.com");
    else {
        echo "Some errors occurred, try again.";
    }

}
?>
24 posts
  • Exclusive Author
  • Has been a member for 1-2 years
hexahedron says

That’s some messed up code. I’m hoping it’s not a WordPress theme.

Anyway, try this:
<?php 

if(isset($_POST[‘name’]) && isset($_POST[‘email’]) && isset($_POST[‘message’])) {
    //Insert your email address
    $mailTo = "davebruzzese@gmail.com";
    //Insert the default subject of the email
    $defaultSubject = "Benefits of an Automated Time Clock Solution-Landing Page";

    (isset( $_POST['subject'] ) ) ? $subject = $_POST['subject'] : $subject = $defaultSubject;

    $name = htmlspecialchars(urldecode($_POST['name']));
    $mailFrom = htmlspecialchars(urldecode($_POST['email']));
    $message_text = htmlspecialchars($_POST['message']);
    $headers = 'Content-type: text/html; charset=UTF-8' . "\r\n";
    $headers .= 'From: '.$mailFrom;
    $message =  " 
                    <head>
                        <title> $subject </title>
                    </head>
    Benefits of an Automated Time Clock Solution - Landing Page    

    Name/Company name: $name

        E-mail: $mailFrom

    ";
    $message .= "Message:

    $message_text
    ";

    if (mail($mailTo, $subject, $message, $headers)) {
        header("Location: http://www.google.com/"); 
    } else { 
        echo "Some errors occurred, try again."; 
    }
}

?>
3 posts
  • Bought between 10 and 49 items
  • Has been a member for 2-3 years
dbruzzese84 says

The email gets sent successfully but still no redirect.

I dont know if this helps but the contact form is an ajax contact form. The theme is called Kibou – Landing Page. It uses function.js to call the forms behaviour i guess?

Im tearing my hair out trying to figure this redirect issue out :(

24 posts
  • Exclusive Author
  • Has been a member for 1-2 years
hexahedron says

Well, there’s your problem.

Open functions.js,
Find this:
//display the success text
result.find(".success").fadeIn();
Add after/before:
window.location.href = 'http://google.com';
3 posts
  • Bought between 10 and 49 items
  • Has been a member for 2-3 years
dbruzzese84 says

YOU ARE A GENIOUS!

Thanks Hex!

by
by
by
by
by
by