View Full Version : How to have form results emailed as bulletd text or html

06-05-2006, 01:13 AM
I am using a php script to email my form results. I would like the form results to show up as bulleted text or html..I have attached the php script. Can any one tell how do this???? I am very new. All help will be appreciated.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="Created by BlueVoda">
<BODY bgcolor="#FFFFFF" text="#000000" <script language="php">
$email = $HTTP_POST_VARS[email];
$mailto = "masterbuilder@computerskinny.com;
$mailsubj = "Thank you for your order";
$mailhead = "From: masterbuilder@computerskinny.com";
reset ($HTTP_POST_VARS);
$mailbody = "Here are the components and software you need for your new computer. Remember, these items were automatically chosen according to the answers you submitted on the checklist. Items listed in ***ALL CAPS*** and bracketed in asterics as shown, are the items you need to read off to your computer manufacturer when placing your order. We suggest you highlight them prior to calling to place your order so you do not miss anything. Enjoy your new computer!!!:\n";
while (list ($key, $val) = each ($HTTP_POST_VARS)) { $mailbody .= "$key : $val\n"; }
if (!eregi("\n",$HTTP_POST_VARS[email])) { mail($mailto, $mailsubj, $mailbody, $mailhead); }
</script> >
<IMG src="m_198.gif" alt="" align="top" border="0" width="700" height="600" style="position:absolute;left:1px;top:0px;width:700px;hei ght:600px;z-index:0">
<DIV style="position:absolute;left:199px;top:175px;width:529px ;height:96px;z-index:1" align="left">
<FONT style="font-size:13px" color="#000000" face="Arial">Thank you for your interest in computerskinny.com<BR>
Your order has been received and we have sent you an email with the specific information you need to give your computer manufacturer.<BR>
We recommend you print the email immediately and put it in a safe place.</FONT>

06-05-2006, 06:25 AM

Here is a reference to a tutorial that will help you set up a php mailto form-

Please make sure to set a max length for each element box you put in the form. If you must put in a free form text area- make sure to set up field validation. http://netisopen.com/computer/TF005/T005.html

Don't use the script you have posted. That script will do nothing but send you the mailbody and thank you that is intended for your customer. Instead, you will use the thank you page to post the information for your customer.

Give that a read and post back if you have any questions.



06-05-2006, 10:41 AM
Hi Andy,

I was following your tutorial on field validation,


There are 4 pages to be created,......name_error.html, email_error.html, contactform.html and confirmationpage.html. (In my case contactform is enquiry.html)

In the form properties, mine will look like this,

Form name: enquiry
Action: processingpage.php
Method: POST
Encoding type: multipart/form-data

In the tutorial, it mention....

""" Lets re-cap what we have to this point. We have four pages- email_error, name_error, contactform and confirmationpage


When I saved enquiry.bvp and published, it doesn't show enquiry.html, instead it is enquiry.php. Am I on the right path?

When I tested the form, it says "The page cannot be found". Obviously, I didn't get it right and the prime suspect is the enquiry.html which I can't seemed to get it in cp.


06-05-2006, 12:27 PM

Actually there are 5 pages.
contactform.html - Has the form on it
name_errorpage.html - States an error in name entry
email_errorpage.html -States an error in e-mail entry
confirmationpage.html -Lets customer/viewer know message has been

processingpage.php - this is the script page that processes the form.

Make your enquiry page html. Right click to get to page properties and make sure the file extension says html.

It looks like, having looked at both tutorials, you are getting them mixed up. The php code for this will not go in the body of any of the pages. The php script will be a stand alone page created in note pad and uploaded to the server via FTP Manager.

Follow the second tutorial and you will see. Give it a whirl and post back if it gives you more of a headache.



06-05-2006, 03:35 PM

It works fine now. The problem is I uploaded the error pages, enquiry page and confirmation page thru' FTP, instead of hitting the publish button in BV. That's why they appear as email_error.bvp, name_error.bvp.....in CP instead of .html.

But the enquiry page is enquiry.php and it still works. ????

Can you help me to see what's "wrong".


click on "Enquiry Form" on the left.

Appreciate your help.

Thanks in advance.

06-05-2006, 05:59 PM
your name and email fields are being checked ok

your 2 large boxes can be sent blank.

do you have error checking pages for those as well ?

06-05-2006, 09:05 PM

It appears to work fine. You apparently melded the two instructions together (which is fine) and incorporated the php script into the confirmation page. As to the enquiry page being php. As far a I have read- it will not affect anything as it will still display the html as it should- it just has no php to execute.

I did notice that your fields have no limit set to them. I suggest that you set a limit to any field that allows you to set a Max Length to it. Make it reasonable -but set a limit.

Keep checking back as David an I are working on a tutorial to secure forms from malicious exploit- which is becomming a big problem.


06-05-2006, 09:45 PM
Html pages that are saved with the .php extension will work just fine. Html and php can be mixed easily (as Andy has done in his first form tutorial) as long as the php code begins and ends with the correct tags. If there is no php code in the page, it will behave as a simple html page, even if it has the .php extension