Page 1 of 1

email form

Posted: Mon May 02, 2005 8:08 am
by wood1e
Hi,

I am trying to sort out a php email form on my webpage...I am working on my pc, and haven;t uploaed the page yet..

I have looked at a small tutorial...but I can't seemt o get it to work. I created a feedback.htm, which is saved on my desktop, and a sendmail.php saved to my htdocs file in the Apache folder.

When I click send, I get the page cannot be displayed...

If I save my feenback.htm to the htdocs file, I click send and the .php file wants to download, ie I get a window that asks if I want to save, or open the file...

The code I have used from the tutorial for sendmail.php,
is

Code: Select all

<?
	$email=$_REQUEST['email'];
	$message=$_REQUEST['message'];

	mail("info@synaxisolutions.co.uk", "Feedback form results",
	$message, "Form:$email");
	header ("Location: http://www.example.com/thankyou.htm");
?>
and the forms code for feedback.htm is

Code: Select all

&lt;form method=&quote;post&quote; action=&quote;sendmail.php&quote; id=&quote;myform&quote;&gt;
   
	 
	 &lt;fieldset&gt;
     &lt;legend&gt;Contact form&lt;/legend&gt;

     &lt;label for=&quote;enquiryname&quote;&gt;&lt;span&gt;Name: &lt;strong class=&quote;red_text&quote;&gt;*&lt;/strong&gt;&lt;/span&gt;&lt;/label&gt;
        &lt;input type=&quote;text&quote; name=&quote;enquiryname&quote; id=&quote;enquiryname&quote; value=&quote;&quote; size=&quote;32&quote; /&gt;&lt;br /&gt;

        &lt;label for=&quote;enquiryemail&quote;&gt;&lt;span&gt;Email Address: &lt;strong class=&quote;red_text&quote;&gt;*&lt;/strong&gt;&lt;/span&gt;&lt;/label&gt;
     &lt;input type=&quote;text&quote; name=&quote;enquiryemail&quote; id=&quote;enquiryemail&quote; value=&quote;&quote; size=&quote;32&quote; /&gt;&lt;br /&gt;

     &lt;label for=&quote;enquirytelephone&quote;&gt;&lt;span&gt;Telephone:&lt;/span&gt;&lt;/label&gt;
     &lt;input type=&quote;text&quote; name=&quote;enquirytelephone&quote; id=&quote;enquirytelephone&quote; value=&quote;&quote; size=&quote;32&quote; /&gt;&lt;br /&gt;

     &lt;label for=&quote;enquiryaddress1&quote;&gt;&lt;span&gt;&lt;strong&gt;Address Line 1:&lt;/strong&gt; &lt;strong class=&quote;red_text&quote;&gt;*&lt;/strong&gt;&lt;/span&gt;&lt;/label&gt;
     &lt;input type=&quote;text&quote; name=&quote;enquiryaddress1&quote; id=&quote;enquiryaddress1&quote; size=&quote;32&quote; value=&quote;&quote; /&gt;&lt;br /&gt;

     &lt;label for=&quote;enquiryaddress2&quote;&gt;&lt;span&gt;Address Line 2:&lt;/span&gt;&lt;/label&gt;
     &lt;input type=&quote;text&quote; name=&quote;enquiryaddress2&quote; id=&quote;enquiryaddress2&quote; size=&quote;32&quote; /&gt;&lt;br /&gt;

     &lt;label for=&quote;enquirytown&quote;&gt;&lt;span&gt;Town: &lt;strong class=&quote;red_text&quote;&gt;*&lt;/strong&gt;&lt;/span&gt;&lt;/label&gt;
     &lt;input type=&quote;text&quote; name=&quote;enquirytown&quote; id=&quote;enquirytown&quote; size=&quote;32&quote; /&gt;&lt;br /&gt;

     &lt;label for=&quote;enquirypostcode&quote;&gt;&lt;span&gt;Postcode: &lt;strong class=&quote;red_text&quote;&gt;*&lt;/strong&gt;&lt;/span&gt;&lt;/label&gt;
     &lt;input type=&quote;text&quote; name=&quote;enquirypostcode&quote; id=&quote;enquirypostcode&quote; value=&quote;&quote; size=&quote;8&quote; /&gt;&lt;br /&gt;

     &lt;label for=&quote;enquirycomments&quote; class=&quote;textarea&quote;&gt;&lt;span&gt;Comments or questions &lt;strong class=&quote;red_text&quote;&gt;*&lt;/strong&gt;&lt;/span&gt;&lt;/label&gt;
        &lt;textarea name=&quote;enquirycomments&quote; id=&quote;enquirycomments&quote; cols=&quote;50&quote; rows=&quote;10&quote;&gt;&lt;/textarea&gt;&lt;br /&gt;

     &lt;label for=&quote;enquirynewsletter&quote; class=&quote;right&quote;&gt;&lt;span&gt;&lt;input type=&quote;checkbox&quote; name=&quote;enquirynewsletter&quote; id=&quote;enquirynewsletter&quote; value=&quote;checkbox&quote; /&gt;&lt;/span&gt;&lt;/label&gt;
     &lt;div class=&quote;comment&quote;&gt;Tick if you wish to receive David Mundell's email newsletters&lt;/div&gt;&lt;/p&gt;

     &lt;label style=&quote;border:none;&quote;&gt;&lt;span&gt;&lt;/span&gt;&lt;/label&gt;
     &lt;input class=&quote;button&quote; type=&quote;submit&quote; value=&quote;Send&quote; name=&quote;submit&quote; class=&quote;submit&quote; /&gt;

        &lt;/fieldset&gt;

&lt;/form&gt;
(I hope I have placed this in the correct tags.)

Anyhelp would be greatly appreciated...

d11wtq | Please read the sticky about posting code in the forums :-D

Posted: Mon May 02, 2005 8:51 am
by Chris Corbyn
It sounds like you don't have PHP installed on your computer if it's prompting you to download the file :?