lisacleverley Posted March 6, 2007 Author Share Posted March 6, 2007 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? Quote Link to comment https://forums.phpfreaks.com/topic/41474-solved-email-contact-form/page/2/#findComment-201216 Share on other sites More sharing options...
willpower Posted March 6, 2007 Share Posted March 6, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/41474-solved-email-contact-form/page/2/#findComment-201226 Share on other sites More sharing options...
lisacleverley Posted March 6, 2007 Author Share Posted March 6, 2007 OK excellent. After reading a few times I do get what your saying... almost 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" Quote Link to comment https://forums.phpfreaks.com/topic/41474-solved-email-contact-form/page/2/#findComment-201270 Share on other sites More sharing options...
willpower Posted March 6, 2007 Share Posted March 6, 2007 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.">"); Quote Link to comment https://forums.phpfreaks.com/topic/41474-solved-email-contact-form/page/2/#findComment-201278 Share on other sites More sharing options...
lisacleverley Posted March 7, 2007 Author Share Posted March 7, 2007 $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.">"); Quote Link to comment https://forums.phpfreaks.com/topic/41474-solved-email-contact-form/page/2/#findComment-201313 Share on other sites More sharing options...
lisacleverley Posted March 7, 2007 Author Share Posted March 7, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/41474-solved-email-contact-form/page/2/#findComment-201317 Share on other sites More sharing options...
redarrow Posted March 7, 2007 Share Posted March 7, 2007 It your look's going to make the code for you ok. Quote Link to comment https://forums.phpfreaks.com/topic/41474-solved-email-contact-form/page/2/#findComment-201320 Share on other sites More sharing options...
redarrow Posted March 7, 2007 Share Posted March 7, 2007 <?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(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/41474-solved-email-contact-form/page/2/#findComment-201325 Share on other sites More sharing options...
redarrow Posted March 7, 2007 Share Posted March 7, 2007 Post your form and i do the rest ok. Quote Link to comment https://forums.phpfreaks.com/topic/41474-solved-email-contact-form/page/2/#findComment-201331 Share on other sites More sharing options...
willpower Posted March 7, 2007 Share Posted March 7, 2007 <?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") ?> Quote Link to comment https://forums.phpfreaks.com/topic/41474-solved-email-contact-form/page/2/#findComment-201343 Share on other sites More sharing options...
willpower Posted March 7, 2007 Share Posted March 7, 2007 redarrow...if you want her form look at page 1. she has a link to it Quote Link to comment https://forums.phpfreaks.com/topic/41474-solved-email-contact-form/page/2/#findComment-201347 Share on other sites More sharing options...
lisacleverley Posted March 7, 2007 Author Share Posted March 7, 2007 Thank you ever so much 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. Quote Link to comment https://forums.phpfreaks.com/topic/41474-solved-email-contact-form/page/2/#findComment-201591 Share on other sites More sharing options...
willpower Posted March 7, 2007 Share Posted March 7, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/41474-solved-email-contact-form/page/2/#findComment-201962 Share on other sites More sharing options...
lisacleverley Posted March 21, 2007 Author Share Posted March 21, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/41474-solved-email-contact-form/page/2/#findComment-212121 Share on other sites More sharing options...
lisacleverley Posted April 21, 2007 Author Share Posted April 21, 2007 I'm back. Anyone want to help with a secure form? Thank you, Lisa Quote Link to comment https://forums.phpfreaks.com/topic/41474-solved-email-contact-form/page/2/#findComment-234663 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.