I am totally new to php and and i dont even know where to begin but on my site www.reliablelandscapingllc.com the submit button doesnt work. Can someone spell out to me whats going on and what I need to do. I’ll paste any code here but I don’t even know what you need! Any help is Greatly Appreciated! Feelin a little stupid…
Works OK for me although you could do with some styling on the error and thank you page.
It “works” but it doesnt send me the information to the email I specified, Thanks for replying, what part of the code do you need to tell whats going on?
Post all of the code in emailform.php
<?php
if(isset($_POST[‘email’])) {
// EDIT THE 2 LINES BELOW AS REQUIRED
$email_to = "info@reliablelandscapingllc.com";
$email_subject = "New e-mail subscriber";
function died($error) {
// your error code can go here
echo "We are very sorry, but there were error(s) found with the form you submitted. ";
echo "These errors appear below.<br /><br />";
echo $error."<br /><br />";
echo "Please go back and fix these errors.<br /><br />";
die();
}
// validation expected data exists
if
(!isset($_POST['email'])) {
died('We are sorry, but there appears to be a problem with the Email Address you submitted.');
}
$email_from = $_POST['email']; // required
$error_message = "";
$email_exp = "^[A-Z0-9._%-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}$";
if(!eregi($email_exp,$email_from)) {
$error_message .= ‘The Email Address you entered does not appear to be valid.<br />’;
}
if(strlen($error_message) > 0) {
died($error_message);
}
$email_message = "Form details below.
";
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message .= "Email: ".clean_string($email_from)."\
";
// create email headers
$headers = 'From: '.$email_from."\r
“.
'Reply-To: '.$email_from.”\r
" .
‘X-Mailer: PHP/’ . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
?>
<!-- include your own success html here –>
Thank you for contacting us. We will be in touch with you very soon.
<?
}
?>
I figured it out, thanks so much
You should include more information in your original posts like error meassages and code first time gdavis882 as “doesnt work” is not very helpful.
Also how did you fix it so others may learn if they read this thread.
Yeah sorry apparently the code worked fine, what I wasn’t getting was the emails sent to by inbox with the subscriber’s info. The problem was with the domain email itself…which I didnt think to test before wracking my brain about the code.