Jump to content

SebbieHE

Members
  • Posts

    13
  • Joined

  • Last visited

SebbieHE's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I use notepad++. What software would you recommend? Thank you for the help by the way.
  2. The actual latest code: <?php $owner_email = $_POST["sebbieharrisonevans@gmail.com"]; $headers = 'From:' . $_POST["email"]; $subject = 'A message from your site visitor ' . $_POST["name"]; $messageBody = ""; if($_POST['name']!='nope'){ $messageBody .= '<p>Visitor: ' . $_POST["name"] . '</p>' . "\n"; $messageBody .= '<br>' . "\n"; } if($_POST['email']!='nope'){ $messageBody .= '<p>Email Address: ' . $_POST['email'] . '</p>' . "\n"; $messageBody .= '<br>' . "\n"; }else{ $headers = ''; } if($_POST['state']!='nope'){ $messageBody .= '<p>State: ' . $_POST['state'] . '</p>' . "\n"; $messageBody .= '<br>' . "\n"; } if($_POST['phone']!='nope'){ $messageBody .= '<p>Phone Number: ' . $_POST['phone'] . '</p>' . "\n"; $messageBody .= '<br>' . "\n"; } if($_POST['fax']!='nope'){ $messageBody .= '<p>Fax Number: ' . $_POST['fax'] . '</p>' . "\n"; $messageBody .= '<br>' . "\n"; } if($_POST['message']!='nope'){ $messageBody .= '<p>Message: ' . $_POST['message'] . '</p>' . "\n"; } if($_POST["stripHTML"] == 'true'){ $messageBody = strip_tags($messageBody); } try{ if(!mail($owner_email, $subject, $messageBody, $headers)){ throw new Exception('mail failed'); }else{ echo 'mail sent'; } }catch(Exception $e){ echo $e->getMessage() ."\n"; } ?>
  3. The form code is below. <form action="send_form.php" id="ContactForm"> <div class="success"> Contact form submitted! I will be in touch soon.</div> <fieldset class="left"> <div class="block"> <label class="name"> <span class="title1">Name:</span> <span class="bg"><input type="text" value="" class="input"></span> <span class="error">*This is not a valid name.</span> <span class="empty">*This field is required.</span> </label> <label class="email"> <span class="title1">Email:</span> <span class="bg"><input type="email" value="" class="input"></span> <span class="error">*This is not a valid email address.</span> <span class="empty">*This field is required.</span></label> <label class="phone"> <span class="title1">Phone:</span> <span class="bg"><input type="tel" value="" class="input"></span> <span class="error">*This is not a valid number.</span> <span class="empty">*This field is required.</span> </label> </div> <div class="block"> <label class="message"> <span class="title1">Message:</span> <span class="bg"><textarea rows="1" cols="2"></textarea></span> <span class="error">*The message is too short.</span> <span class="empty">*This field is required.</span> </label> </div> <div class="formButtons"> <div class="formBtn"> <a href="#" data-type="submit" class="moreButton">Send</a> </div> <div class="formBtn"> <a href="#" data-type="reset" class="moreButton">Clear</a> </div> </div> </fieldset> </form>
  4. See. I put my email address there and the form still didn't work. Any advise?
  5. Hello. Please could someone tell me where to put MY email address so that when they send the message, I receive the email? <?php $owner_email = $_POST["owner_email"]; $headers = 'From:' . $_POST["email"]; $subject = 'A message from your site visitor ' . $_POST["name"]; $messageBody = ""; if($_POST['name']!='nope'){ $messageBody .= '<p>Visitor: ' . $_POST["name"] . '</p>' . "\n"; $messageBody .= '<br>' . "\n"; } if($_POST['email']!='nope'){ $messageBody .= '<p>Email Address: ' . $_POST['email'] . '</p>' . "\n"; $messageBody .= '<br>' . "\n"; }else{ $headers = ''; } if($_POST['state']!='nope'){ $messageBody .= '<p>State: ' . $_POST['state'] . '</p>' . "\n"; $messageBody .= '<br>' . "\n"; } if($_POST['phone']!='nope'){ $messageBody .= '<p>Phone Number: ' . $_POST['phone'] . '</p>' . "\n"; $messageBody .= '<br>' . "\n"; } if($_POST['fax']!='nope'){ $messageBody .= '<p>Fax Number: ' . $_POST['fax'] . '</p>' . "\n"; $messageBody .= '<br>' . "\n"; } if($_POST['message']!='nope'){ $messageBody .= '<p>Message: ' . $_POST['message'] . '</p>' . "\n"; } if($_POST["stripHTML"] == 'true'){ $messageBody = strip_tags($messageBody); } try{ if(!mail($owner_email, $subject, $messageBody, $headers)){ throw new Exception('mail failed'); }else{ echo 'mail sent'; } }catch(Exception $e){ echo $e->getMessage() ."\n"; } ?>
  6. Because I haven't bought my domain/hosting package yet. Unless there is a free one that supports php?
  7. Okay sorry for late reply, lost the php so had to make it again. Will this php work with the HTML? <?php if(isset($_POST['email'])) { $email_to = "you@yourdomain.com"; $email_subject = "Query"; function died($error) { 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(); } if(!isset($_POST['name']) || !isset($_POST['email']) || !isset($_POST['phone']) || !isset($_POST['message'])) { died('We are sorry, but there appears to be a problem with the form you submitted.'); } $first_name = $_POST['name']; // required $last_name = $_POST['email']; // required $email_from = $_POST['phone']; // required $comments = $_POST['message']; // required $error_message = ""; $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/'; if(!preg_match($email_exp,$email_from)) { $error_message .= 'The Email Address you entered does not appear to be valid.<br />'; } $string_exp = "/^[A-Za-z .'-]+$/"; if(!preg_match($string_exp,$first_name)) { $error_message .= 'The First Name you entered does not appear to be valid.<br />'; } if(!preg_match($string_exp,$last_name)) { $error_message .= 'The Last Name you entered does not appear to be valid.<br />'; } if(strlen($comments) < 2) { $error_message .= 'The Comments you entered do not appear to be valid.<br />'; } if(strlen($error_message) > 0) { died($error_message); } $email_message = "Form details below.\n\n"; function clean_string($string) { $bad = array("content-type","bcc:","to:","cc:","href"); return str_replace($bad,"",$string); } $email_message .= "Name: ".clean_string($name)."\n"; $email_message .= "Email: ".clean_string($email)."\n"; $email_message .= "Phone: ".clean_string($phone)."\n"; $email_message .= "Message: ".clean_string($message)."\n"; $headers = 'From: '.$email_from."\r\n". 'Reply-To: '.$email_from."\r\n" . 'X-Mailer: PHP/' . phpversion(); @mail($email_to, $email_subject, $email_message, $headers); ?> Thank you for contacting us. We will be in touch with you very soon. <?php } ?>
  8. What do you mean? I've done contact forms before but, this one is harder.
  9. Sorry 'Please could someone help me make the PHP script so that contact form sends the info typed in to my email address?'.
  10. <form action="#" id="ContactForm"> <div class="success"> Contact form submitted! I will be in touch soon.</div> <fieldset class="left"> <div class="block"> <label class="name padRight3"> <span class="title1">Name:</span> <span class="bg"><input type="text" value="" class="input"></span> <span class="error">*This is not a valid name.</span> <span class="empty">*This field is required.</span> </label> <label class="email"> <span class="title1">Email:</span> <span class="bg"><input type="email" value="" class="input"></span> <span class="error">*This is not a valid email address.</span> <span class="empty">*This field is required.</span></label> <label class="phone"> <span class="title1">Phone:</span> <span class="bg"><input type="tel" value="" class="input"></span> <span class="error">*This is not a valid number.</span> <span class="empty">*This field is required.</span> </label> </div> <div class="block"> <label class="message"> <span class="title1">Message:</span> <span class="bg"><textarea rows="1" cols="2"></textarea></span> <span class="error">*The message is too short.</span> <span class="empty">*This field is required.</span> </label> </div> <div class="formButtons"> <div class="formBtn"> <a href="#" data-type="submit" class="moreButton">Send</a> </div> <div class="formBtn"> <a href="#" data-type="reset" class="moreButton">Clear</a> </div> </div> </fieldset> </form>
×
×
  • 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.