Jump to content

PHP Help... New to this -__-


scCam86

Recommended Posts

Okay, so when I hit submit, it goes to /php/contactus.php instead of /thank-you.html, but it still displays the content of the /thank-you.html page

 

I'm not sure what I'm doing wrong, and It's been eating me alive for a few hours. I know it's something simple that I'm overlooking. Here's the code....

 

The code functions properly, otherwise. It sends one email to "$email" and it sends two copies of just the data posted to the other emails.

It just doesn't direct to the "thank you" page.

 

----

 

<?php

$subject = "Thanks For Connecting With Me!";
$from = "email@email.com";
$fromName = "Name Here";
$name = $_POST["name"];
$email = $_POST["email"];
$region = $_POST["region"];
$notes = $_POST["notes"];

$message1 = "Prospect Name: " . $name . "\nProspect Email: " . $email . "\nProspect Phone: " . $phone . "\nProspect Region: " . $region . "\nProspect Notes: " . $notes
;

$message2 = "blah, blah, blah";


if(mail($email, $subject, $message2, $from)){
  header("Location: ../thank-you.html");
}else{
  echo "Message was not sent!";
}

mail("email1@gmail.com", "Prospect Contact Info", $message1, $from);
mail("email2@gmail.com", "Prospect Contact Info", $message1, $from)


?>

Link to comment
Share on other sites

you need an exit; after the header redirection.Without more info I think that will take care of it. Also...use code tags. It will make it much easier for people to read.

if(mail($email,$subject,$messag2,$from)){ 
  header("Location: ../thank-you.html"); 
  exit;
}

 

Okay, so when I hit submit, it goes to /php/contactus.php instead of /thank-you.html, but it still displays the content of the /thank-you.html page

 

I'm not sure what I'm doing wrong, and It's been eating me alive for a few hours. I know it's something simple that I'm overlooking. Here's the code....

 

The code functions properly, otherwise. It sends one email to "$email" and it sends two copies of just the data posted to the other emails.

It just doesn't direct to the "thank you" page.

 

----

 

<?php

$subject = "Thanks For Connecting With Me!";
$from = "email@email.com";
$fromName = "Name Here";
$name = $_POST["name"];
$email = $_POST["email"];
$region = $_POST["region"];
$notes = $_POST["notes"];

$message1 = "Prospect Name: " . $name . "\nProspect Email: " . $email . "\nProspect Phone: " . $phone . "\nProspect Region: " . $region . "\nProspect Notes: " . $notes
;

$message2 = "blah, blah, blah";


if(mail($email, $subject, $message2, $from)){
  header("Location: ../thank-you.html");
}else{
  echo "Message was not sent!";
}

mail("email1@gmail.com", "Prospect Contact Info", $message1, $from);
mail("email2@gmail.com", "Prospect Contact Info", $message1, $from)


?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.