contact form - output to page and email
Posted on
16th Feb 2014 07:03 pm by
admin
I have the following in my controller:
$message['name'] = htmlentities(strip_tags(trim($_POST['name'])));
Did you know?Explore Trending and Topic pages for more stories like this.
$message['email'] = htmlentities(strip_tags(trim($_POST['email'])));
$to = "info@mywebsite.com";
$subject = "Website Enquiry";
$content = html_entity_decode(implode("nn", $message));
$content.= "nnIP Address: ".$_SERVER['REMOTE_ADDR'];
$headers = "From: ".strip_tags(trim($_POST['name']))." <".strip_tags(trim($_POST['email'])).">";
@mail($to,$subject,$content,$headers);
And the following in my view:
echo '<tr><th><b>Name: </b></th><td>'.$message['name'].'</td></tr>';
echo '<tr><th><b>Email Address: </b></th><td>'.$message['email'].'</td></tr>';
This works as expected - the POST data is output to the page and is also sent in the email. However the email does not contain the field labels, for example 'Name: ' and 'Email Address: '.
This is obviously because I don't include the labels in their respective $message[] elements, as I need to enclose these in HTML tags in the view. I don't intend to include any HTML code in my controller, so does anyone have any idea how I can satisfy both requirements?
No comments posted yet
Your Answer:
Login to answer
197
20
Other forums
asp authentication problem
Hello all,
I want to use the asp authentication (from asp.net configuration) in my web site. there
Can I use a loop
Hi buddies!
Once again with my doubts here.
Right now I am using this sql stat
Page doesn't expand for content
Hi. I've been testing a query I made. It's here http://lapr1.6te.net/inquerito.php
The page doesn
Impact of movement type 412 E on MAP
Hi
Usage of movement type 412 E is causing huge change in MAP .
Is there any r
cURL and Sessions
Ohai.
So, I'm trying to cURL a bunch of things off of a page, and put them into a session. I'
jquery validation in codeIgniter
hai i need to add client side validation to my fiels which are selected in a forloop.the fields are
Problem with umlauts and UTF-8
Hello every1,
I'm creating my own little CMS at the moment and got some problems with the cha
PHP/Database issue
My friend is helping me make a database where you go to a certain webpage of my site and the page wi
upload control not working with update panel
Hi,
I am working with Asp.Net FileUpload control with ajax update panel,
if i use the
why is it over writing
Code: $filepaths[] = $_FILES['new_image'];
foreach ($filepaths as $filepath)
{
$imagename =