where is the rest of the code that actually sends the email out?
Line 58 Jay
Hahahah i copied it out but it stopped shy of that part lol
here is how i would do it, not sure about [member=46186]Kevin Rubio[/member] or [member=72272]astonecipher[/member] they may have a better way.
[php]<?php
/* Check to see if the html was sent via $_POST /
if ($_SERVER[‘REQUEST_METHOD’] == ‘POST’){
/ If true we continue on with the script */
/* Subject and Email Variables */
$emailSubject = ‘2017 Windemuth Family Reunion Registration Form’;
/* Gathering Data Variables */
/*compare the email address */
if($_POST[‘email1’] != $_POST[‘email2’]) {
#set error…
$error .= ‘The email addresses dont match’;
}
$Descendant = $_POST[‘descendant’];
$Spouse = $_POST[‘spouse’];
$Child1 = $_POST[‘child1’];
$Child2 = $_POST[‘child2’];
$Child3 = $_POST[‘child3’];
$Child4 = $_POST[‘child4’];
$Street = $_POST[‘street’];
$City = $_POST[‘city’];
$StateProvince = $_POST[‘stateprovince’];
$PostalCode = $_POST[‘postalcode’];
$Phone = $_POST[‘phone’];
$Email = $_POST[‘email’];
$Confirm = $_POST[‘confirm’];
$Adults = $_POST[‘adults’];
$Children = $_POST[‘children’];
$RegistrationFee = $_POST[‘registrationfee’];
$Comments = $_POST[‘comments’];
$webMaster = $Descendant.‘[email protected]’;
$immigrant="";
foreach($_POST[“immigrant”] as $option){
$immigrant .= $option;
}
$body = <<<EOD
Descendant: $Descendant
Spouse: $Spouse
Child1: $Child1
Child2: $Child2
Child3: $Child3
Child4: $Child4
Street: $Street
City: $City
StateProvince: $StateProvince
PostalCode: $PostalCode
Phone: $Phone
Email: $Email
Confirm: $Confirm
Descended From: $immigrant
Adults: $Adults
Children: $Children
RegistrationFee: $RegistrationFee
Comments: $Comments
EOD;
$headers = “From: $email\r\n”;
$headers .= “Content-type: text/html\r\n”;
/* if we got any errors echo out the error otherwise send the mail */
if($error) {
echo $error;
}else{
$success = mail ($webMaster, $emailSubject, $body, $headers);
echo “Your Registration has been submitted successfully. We will contact you by email and confirm your Registration within 48 hours.”;
}
}else{
/* If $_POST check is false give this message */
echo ‘Form Submission error. Back;’;
}
?>[/php]
You are creating a bunch of variables for nothing. You already have variables, just use them.
me? or him?
the only var i made was the error var …
but i think what [member=46186]Kevin Rubio[/member] is talking about is this
[php]$Descendant = $_POST[‘descendant’];
$Spouse = $_POST[‘spouse’];
$Child1 = $_POST[‘child1’];
$Child2 = $_POST[‘child2’];
$Child3 = $_POST[‘child3’];
$Child4 = $_POST[‘child4’];
$Street = $_POST[‘street’];
$City = $_POST[‘city’];
$StateProvince = $_POST[‘stateprovince’];
$PostalCode = $_POST[‘postalcode’];
$Phone = $_POST[‘phone’];
$Email = $_POST[‘email’];
$Confirm = $_POST[‘confirm’];
$Adults = $_POST[‘adults’];
$Children = $_POST[‘children’];
$RegistrationFee = $_POST[‘registrationfee’];
$Comments = $_POST[‘comments’];
$webMaster = $Descendant.‘[email protected]’;[/php]
can be gotten rid of and just do this …
[php]$body = <<<EOD
Descendant: $_POST[‘descendant’]
Spouse: $_POST[‘spouse’]
Child1: $_POST[‘child1’]
Child2: $_POST[‘child2’]
Child3: $_POST[‘child3’]
Child4: $_POST[‘child4’]
ect …[/php]
I tried the code and I get this error:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
I tried changing the “email1” and “email2” to “email” and “confirm” like they are in the form and I still get the same error. Am I doing something drastically wrong?
Am I doing something drastically wrong?
Yes. You have a quotes problem on line 77. You need to turn on error reporting.
yea sorry fat fingers got the best of me…,
change
[php]echo ‘Form Submission error. Back;’;[/php]
to
[php]echo ‘Form Submission error. <a href=“javascript:history.back(1);”>Back’;[/php]
Close but no cigar. Let’s see if you spot what you did.
:-X
yes i had an ID-10-T error my bad …
tested and working:
[php]echo “Form Submission error. Back”;[/php]
I must have something else wrong as well because I keep getting the same error whenever I hit the “Submit” button on the form. I’ll keep working on this, but I am WAY out of my league here.
OP, the end of the HEREDOC can not have any spaces before it.
You just confused me completely. Could you please explain in more detail?
This needs to be at the very start of the line. No indentation.
EOD;
See the big red box here http://php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc
[member=84673]Jim-W-1949[/member] can i see your entire html as well
Jay, the code you posted is fine. When you copy it from the forum the heredoc is indented.
You were absolutely correct, I fixed that and all is well. You guys are great!!! Thanks to all of you for helping me out, I doubt I could ever have done it without your help.
You know, thinking about it, I find it helps me to understand this stuff better when I can see what the code SHOULD look like. But in any case, I can see that I have to do a whole lot more studying before I am even a LITTLE bit knowledgeable.in this stuff.
You know, thinking about it, I find it helps me to understand this stuff better when I can see what the code SHOULD look like.
Nothing wrong with that. I am the same way.
PHP is a complicated simple language that is very easy to get wrong.