Jump to content

PHP Contact Form


faulknerd

Recommended Posts

My name is Dennis Faulkner and I am new to all this so please bare with me. I have a problem I have been trying to solve with my PHP Contact Form.

 

I have a php contactForm I am developing for my WebSite. I want to add a ( post script/some text ) to the very bottom of the body content. The line of code that sets up all content is as follows:
mail($email_to, $email_subject, $email_content);
I have set an email variable in the top of my php code that reads:
$post_script = 'This mail was sent from the Contact Form';
I thought I'd add this to the mail line of code that reads:
mail($email_to, $email_subject, $email_content, $post_script);
When I test my email form and receive my test email, it adds the $post_script text:
'This mail was sent from the Contact Form'
to the body content but at the very top.
I also want to have a line of space between the emailers Name, Email, and Content.
I hope I have made sense and someone can help me with this problem. I can make all my code available if required.
JustSomeGuy
Thank you for your reply, much appreciated, however I still don't properly understand so I have attached my php file. Would you be so kind and take a look and let me know.
Regards Dennis.

contact.php

Edited by faulknerd
Link to comment
Share on other sites

Search through the code for where you build the $email_content variable, you can make your changes there. Putting a comma and then another variable doesn't work, the 4th parameter to the mail function is additional headers. In your case, just adding more text there causes your email client to think that the email is malformed so it shows the broken header as the first line of text. Here's the reference for the mail function in case you're curious:http://php.net/manual/en/function.mail.php

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...