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'])));

$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 Like 20 Dislike
Previous forums Next forums
Other forums

Accessing Infotype data in dialog program
Hi All
In Dialog programs attributes I didn't see any logical database field. How can I access

line breaks in between fetched file names
Hi,

I have this code:
Code: <?php
if($dir = opendir('files')){
while (($f

Pagination won't carry results past page 2.
Hi all,

I've worked out my pagination script and its paginating fine until I click next from

button help
i originally had this but realised it is much easier to have a button.

Code: <?php

media recovery
Hi,
i startup the database i got the error

SQL> startup
ORACLE instance started.

Getting Subdomain Name With PHP?
I want to grab the subdomain name with PHP so I can generate database queries.

for example my

MYSQL gen help
This is my Mysql gen. can anyone tell me why this echos

MID(networkset.networkid, 3, 3) AS &q

how to get different value in second view of webdynpro?
hello guys,

In ABAP webdynpro I am trying to create one application having two views.

DirectoryIterator and Hacked Website
Hi Everyone.

My problem:
Some one has been sneaking in to my website hidden Iframes. I've

Struct/union and scope problem!
HI all , I have
Code: in header.h typedef struct Node Link; /* ---------

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash