0

I am currently using a feed back form on my site and I am trying to get that feedback form to send to my email but keep getting notices maybe someone can send me the right way to write it thanks so much here is all my code and the errors..

FORM

    <script type="text/javascript">
    function MM_validateForm() { //v4.0
      if (document.getElementById){
        var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
        for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
          if (val) { nm=val.name; if ((val=val.value)!="") {
            if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
              if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
            } else if (test!='R') { num = parseFloat(val);
              if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
              if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
                min=test.substring(8,p); max=test.substring(p+1);
                if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
          } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
        } if (errors) alert('The following error(s) occurred:\n'+errors);
        document.MM_returnValue = (errors == '');
    } }
    </script>
            <div id="services">
              <h3><a href="services.php">Services</a></h3>
              <p>What we can do</p>
              <ul>
               <li>item</li>
               <li>item</li>
               <li>item</li>
               <li>item</li>
              </ul>
              </div>
            <div id="portfolio">
              <h3><a href="portfolio.php">Portfolio</a></h3>
                 <p>Some of our work</p>
            </div>
            <div id="hireus">
          <h3><a href="services.php">Request more info below!</a></h3>
          <form action="processor.php" method="post" name="myform" id="myform" onsubmit="MM_validateForm('fname','','R','lname','','R','email','','RisEmail','phone','','NisNum');return document.MM_returnValue">
        <label for="fname">First name</label>
        <input name="fname" type="text" id="fname" />
        <label for="lname">Last name</label>
        <input name="lname" type="text" id="lname" />
        <label for="email">Email Address</label>
        <input name="email" type="text" id="email" />
        <label for="phone">Phone Number</label>
        <input name="phone" type="text" id="phone" placeholder="800.867.5309" />
        <fieldset class="checkgroup">
        <legend>Services Interested In:</legend>
        <input name="services" type="checkbox" value="services_web" id="services_web" />
        <label for="services_web">Web Design</label>
         <input name="services" type="checkbox" value="services_design" id="services_design" />
        <label for="services_web">Video & 3D</label>
         <input name="services" type="checkbox" value="services_consultation" id="services_consultation" />
        <label for="services_web">Consulation</label>
        </fieldset>
        <textarea name="comments" id="comments" cols="35" rows="3"></textarea>
        <input name="submit" type="submit" value="Submit Info" />
        </form>

              </div>

 PROCESSOR 



<?php
/************************

*PHP Form Processor * *************/

//Trim removes white space after strip_tags gets rid of any html, javascript, etc tags from the input
$fname = trim(strip_tags($_POST['fname']));
$lname = trim(strip_tags($_POST['lname']));
$email = trim(strip_tags($_POST['email']));
$phone = trim(strip_tags($_POST['phone']));
$services = trim(strip_tags($_POST['services']));
$comments = trim(strip_tags($_POST['comments']));

//Creating a single variable to format and hold all the inputs
$body = "
Website Contact Form
First Name: $fname
Last Name: $lname
Email Address: $email
Phone: $phone
Services Interested In: $services
Comments: $comments";

mail ("[email protected]","Widget Box Contact Form","$body","$email");
mail ("$email","Widget Box Contact Form","$body","[email protected]");

?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="css/reset.css" />
<link rel="stylesheet" type="text/css" href="css/formatBlog.css" />
<title>Schell Shock Design's Portfolio</title>
</head>

<body class="tos">
  <div id="login">
   <?php include('login.php'); ?>
</div>
  </div>
  <div id="utilities">
   <?php include('utilities.php'); ?>
  </div>
<div id="container">
  <header>
    <?php include('header.php'); ?>
   </header>
 <div id="formsuccess">
            <h3>Thank You!</h3>
    <?php
//if the email was sent, show the success message
    echo '<div class="success">Thanks '.$fname.'. Your message was sent.</div>';
        echo '<div class="success">A copy of your form results were also mailed to '.$email.'.</div>';
    echo '<div class="success">We will get back to you at: '.$email.' or at: '.$phone.' within 24 hours.</div>';
?>

          </div>
  <div id="footer">
    <?php include('footer.php'); ?>
         </div>
</div>
</body>
</html>

My Warnings:

Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:\xampp\htdocs\schellshockdesign.com\term5final\finalproject\processor.php on line 24

Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:\xampp\htdocs\schellshockdesign.com\term5final\finalproject\processor.php on line 25
1
  • Please be aware of the limitations of the built in PHP mail function. You will very likely suffer deliverability issues since many SMTP servers are configured to reject emails with improperly set headers. I would look into a library that handles this for you like PHPmailer. Commented Jul 7, 2012 at 18:55

2 Answers 2

1

try

mail ("[email protected]","Widget Box Contact Form","$body","From: $email");
mail ("$email","Widget Box Contact Form","$body","From: [email protected]");
Sign up to request clarification or add additional context in comments.

Comments

0

You want to set a FROM Header... as the error sais

mail ("[email protected]","Widget Box Contact Form","$body","FROM: $email");
mail ("$email","Widget Box Contact Form","$body","FROM: [email protected]");

3 Comments

Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\xampp\htdocs\schellshockdesign.com\term5final\finalproject\processor.php on line 24 Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\xampp\htdocs\schellshockdesign.com\term5final\finalproject\processor.php on line 25
That fixed the first part, but could this be happening because I am using Xampp or what, if I upload to my site will it work or no....
Xampp doesn't include server mail. You will have to install another service. At your server you will have no problems.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.