forms - PHP Change name of sender. -


this question exact duplicate of:

when form submitted change name of sender. right shows test domain name sender when email.

    <?php      if ($_post["submit"]) {           $result='<div class="alert alert-success">form submitted</div>';      if (!$_post['name']) {          $error="<br />please enter name";      }      if (!$_post['email']) {          $error.="<br />please enter email address";      }      if (!$_post['comment']) {          $error.="<br />please enter comment";      }      if ($_post['email']!="" , !filter_var($_post['email'], filter_validate_email)) {           $error.="<br />please enter valid email address";      }      if ($error) {          $result='<div class="alert alert-danger"><strong>there error(s) in form:</strong>'.$error.'</div>';      } else {          if (mail("email@email.com", "comment website!", "name: ".$_post['name'],."              email: ".$_post['email']."              comment: ".$_post['comment'])) {                  $result='<div class="alert alert-success"><strong>thank you!</strong> i\'ll in touch</div>';                  } else {                  $result='<div class="alert alert-danger"><strong>sorry, there error sending message. please try again later.</strong></div>';                  }          }       }    ?> 

form

    <div class="container">      <div class="row">          <div class="col-md-6 col-md-offset-3 emailform">              <h1>my email form</h1>              <?php echo $result; ?>              <p class="lead"> please in touch - i'll can.</p>              <form method="post">                  <div class="form-group">                      <label for="name">your name:</label>                     <input type="text" name="name" class="form-control" placeholder="your name" value="<?php echo $_post['name']; ?>" />                  </div>                  <div class="form-group">                      <label for="email">your email:</label>                     <input type="email" name="email" class="form-control" placeholder="your email" value="<?php echo $_post['email']; ?>" />                  </div>                  <div class="form-group">                      <label for="comment">your comment:</label>                     <textarea class="form-control" name="comment"><?php echo $_post['comment']; ?></textarea>                  </div>                  <input type="submit" name="submit" class="btn btn-success btn-lg" value="submit" />              </form>           </div>      </div>  </div> 

this first contact form, , appreciate help!

thanks in advance!

as stated in php documentation

$to      = 'user@example.com'; $subject = 'comment website!'; $message = 'hello'; $headers = 'from: your_name@example.com' . "\r\n" .     'reply-to: your_name@example.com' . "\r\n" .     'x-mailer: php/' . phpversion();  mail($to, $subject, $message, $headers); 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -