Include fields in message of PHP contact form -
being bad @ php, i've decided post here last resort. want add "who" variable message body of emails sent via php contact form. form works fine name, email , message "who" input part of email message comes through, way communicate being referred.
i have tried add $who=$_request['who']; $who mail line neither work, latter doesn't send email @ all.
<?php $action=$_request['action']; if ($action=="") /* display contact form */ { ?> <form action="" method="post" enctype="multipart/form-data"> <input type="hidden" name="action" value="submit"> <input name="name" type="text" placeholder="your name" value="" size="14"/> <input name="email" type="text" placeholder="your email" value="" size="14"/> <textarea name="who" placeholder="who should contact?" rows="1" cols="14"></textarea> <textarea name="message" placeholder="description" rows="2" cols="14"></textarea><br> <input type="submit" class="button special" value="submit"/> </form> <?php } else { $name=$_request['name']; $email=$_request['email']; $message=$_request['message']; if (($name=="")||($email=="")||($message=="")) { echo "all fields required, please fill out <a href=\"\">the form</a> again."; } else{ $from="from: $name<$email>\r\nreturn-path: $email"; $subject="referral ******* **"; mail("chris@********.com.au", $subject, $message, $from); } { echo "<script type='text/javascript'>window.location.href ='../thanks.php';</script>"; } } ?>
in php . concatenation operator returns concatenation of right , left arguments try this
$name = $_request['name']; $email = $_request['email']; $message = $_request['message'] . "\n\rfrom: " . $_request['who'];
Comments
Post a Comment