php not working with email form -
my email form doesn't seem wanna work keeps coming php form instead of message should here html part of form
<div class="row"> <div class="col-sm-12"> <p>the band love hear form you!</p> </div> </div> <div class="row moveme3"> <div class="col-sm-12"> <div id="contact-form"> <form id="contact" method="post" action="process.php"> <fieldset> <label for="name">full name</label> <input type="text" id="name" name="name" placeholder="full name" title="enter name" class="required"> <label for="email">e-mail</label> <input type="email" id="email" name="email" placeholder="yourname@domain.com" title="enter e-mail address" class="required email"> <label for="message">question/comment</label> <textarea name="message" id="message"></textarea> <input type="submit" name="submit" class="btn btn-success btnmove" id="submit" value="send message" /> </fieldset> </form> </div> </div><!-- /end #contact-form --> <div id="response"></div> </div> <div class="contactus" id="moveme2"> <img src = "images/envalope.jpg" alt="contact" class="img-responsive" /> </div>
here the first php goes
<?php // data $name = check_input($_post['name'], "please enter name!<a href='javascript:history.back(1);'>back</a>"); $email = check_input($_post['email'], "please enter email address!<a href='javascript:history.back(1);'>back</a>"); $message = check_input($_post['message'], "please enter message!<a href='javascript:history.back(1);'>back</a>"); //email validation $email = htmlspecialchars($_post['email']); if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/",$email)) { die("we're sorry, went wrong please chenck on , try again."); } //function check eliminate unwanted characters, strips quotes, , adds htmlspecialcharacters function check_input($data, $problem='') { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); if ($problem && strlen($data) == 0) { die($problem); } return $data; } //spammer check $email = urldecode($email); if (eregi("\r",$email) || eregi("\n",$email)) { die("spammer detected"); } //sends email , forwards thank page mail( "preshesgirl@yahoo.com", $subject, $message, "from: $name <$email>" ); header( "location: thankyou.php" ); ?>
here second php goes
<?php include('header.php'); ?> <?php include('nav.php'); ?> <div class="row"> <div class="col-sm-12"> <div id="response"></div> <div class="contactus" id="moveme2"> <h1>we soon!</h1> <img src="images/thanks.jpg" title="thank you" alt="thank you" class="img-responsive"> </div> </div> </div> <?php include('footer.php'); ?>
you need concatenate php variables string opposed having names of variables being interpreted part of string.
check process.php
mail( "preshesgirl@yahoo.com", $subject, $message, "from: ".$name." <".$email.">" );
it was:
mail( "preshesgirl@yahoo.com", $subject, $message, "from: $name <$email>" );
Comments
Post a Comment