Jump to content

[SOLVED] Email Contact Form


lisacleverley

Recommended Posts

OK lol. So it's been changed to reflect...

 

mail("Lisa Cleverley <".$email_address. ">",$subject_prefix,$comments,"From: ".$name." <".$email.">");

 

Tried and tested and got email (woo lol) but only got the comments part and nothing else. Do I edit the above to include the rest as testing below...

 

mail("Lisa Cleverley <".$email_address. ">",$subject_prefix,$event,$dateevent,$comments,"From: ".$name." <".$email.">");

 

??? Is that right?

Link to comment
Share on other sites

aww...nearly.

 

 

Right the $comments bit in the mail command is basically providing you with the message to be sent.

 

So what we have to do is contruct that 'message'.

 

1.  Change the code back to mail (.........$message.....) rather than comments (yes undo what we just spoke about in last post) and then we will add in our NEW $message.

 

Obviously...before we mail it...we need to say what it will be.

 

$message =

 

now we tell it what we want in it.

 

$message = $comments;

 

but we want more in there dont we...like the $event....

 

$message = $comments.$event;

 

BUt unfortunately this will just stick them together in an upleasnt way so we add so text in there too.

 

$message="Comments: ".$message."\n\nEvent:".$event;

 

The text you want to include in put in " " the . means attach this and the \n means 'next line'

 

So NOW you should be just about able to construct the email in the way you want with the formatting you want.

 

 

Link to comment
Share on other sites

OK excellent. After reading a few times I do get what your saying... almost  :D

 

Although *I* think this is right. Uploaded and tested and seem to be getting an error message...

 

    mail("Lisa Cleverley <".$email_address. ">",$subject_prefix,$message = "Event:".$event"\n\nDate Of Event:".$dateevent"\n\nComments:".$comments,"From: ".$name." <".$email.">");

 

Error message is "Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/babiesbo/public_html/email/send.php on line 38"

Link to comment
Share on other sites

So close

 

what you have done...if you think about it...is tell the script to mail the $message...and then said...and by the way...this is what the $message is.

 

Wew need to let the script know before hand.

 

so

 

$message = "blah";

 

 

mail("Lisa Cleveryley <".$email_address. ">",$subject_prefix,$message,"From: ".$name." <".$email.">");

Link to comment
Share on other sites

$message="Comments: ".$message."\n\nEvent:".$event;

 

RE the above. I just realised my coding only had one . and not one on each side. Trying 2...

 

    mail("Lisa Cleverley <".$email_address. ">",$subject_prefix,$message = "Event:".$event."\n\nDate Of Event:".$dateevent."\n\nComments:".$comments.,"From: ".$name." <".$email.">");

Link to comment
Share on other sites

No that can't be right either getting error "Parse error: parse error, unexpected ',' in /home/babiesbo/public_html/email/send.php on line 38"

 

*shuffle* can you put me out of my misery and correct my code please? I'm stumped now *shrug*

 

Editing to add: Off to bed now. I need to get up early tomorrow. Will check back tomorrow :)

Link to comment
Share on other sites

<?php

ob_start();

$to = 'myemailaddress@email.com';

$subject = $subject;

$message = $message;

$headers = "From: Website Contact\r\n" .

       'X-Mailer: PHP/' . phpversion() . "\r\n" .
       
       "MIME-Version: 1.0\r\n" .
       
       "Content-Type: text/html; charset=utf-8\r\n" .
       
       "Content-Transfer-Encoding: 8bit\r\n\r\n";
       
if(mail($to, $subject, $message, $headers)){ 

header("Location: sent.htm");

}else{

echo "mail not sent";
}
ob_end_flush();
?>

Link to comment
Share on other sites

<?php

 

$email_address = "my_email_address"; //need to change to your address

$subject = "Contact from Website"; 

 

 

$name = $_POST['name'];

$email = $_POST['email'];

$event = $_POST['event'];

$dateevent = $_POST['dateevent'];

$comments = $_POST['comments'];

 

$message ="Contact Name:".$name."\n\nEmail-Address:".$email."\n\nEvent:".$event."\n\nDate:".$date."\n\nComments:".$comments;

 

mail($toname."<".$email_address.">",$subject,$message,"From: ".$name."<".$email.">");

 

//Redirects to sent.htm 

    header("Location: sent.htm")

 

?>

Link to comment
Share on other sites

Thank you ever so much :D I can see where I was going wrong and trying to add the extra coding in the wrong part.

 

Saved and uploaded and working perfect, thank you again.

 

If you ever need a free photo shoot, I'm your lady lol.

 

Is it possible to add some Captcha into that coding so it can be secure. If so, how do I go about doing that? I was on this webpage, downloaded that and tried that. Had to rename and change all names in the forms etc as my server does lowercase.

Link to comment
Share on other sites

Captcha images such as that dont increase security as such....but they do stop 'robots' from form submission and I suppose in that sense it does add a small level of security.

 

What we really need to do is validate  and check that the user input does conform to certain rules.

 

Now it is advisable...but if this script had curled your toes...then..well...its up to you.  Perhaps best to PM.me or email me and we can develop a script for you offline.

 

Let me know what you think's best.

 

By the way i have written a 'captcha' script which would allow you to customise the images and fonts used to provide a bit of creative flexibility to your site.

 

Will

 

PS you'd never catch me in front of a camera

Link to comment
Share on other sites

  • 2 weeks later...

I did email Will about adding security to this current form but he must be busy and hasn't been online in a while, so asking for help here. It's not 100% urgent as I'm on temporary dial up at the min (changng ISP providers between 2 broadband suppliers and had to wait for line to be free of markers)

 

Any help greatly appreciated.

 

Thank you,

Lisa

Link to comment
Share on other sites

  • 5 weeks later...
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.