View Full Version : Problems with posting a form

05-31-2008, 12:19 PM
I've use the example within the form suggestion (Using DW and PHP to send form results in an email) but the sendresults.php is returned. No email is sent. Any suggestions? Here's my file...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>

//--------------------------Set these paramaters--------------------------

// Subject of email sent to you.
$subject = 'Results from Contact form';

// Your email address. This is where the form information will be sent.
$emailadd = 'gwolfe7@wi.rr.com';

// Where to redirect after form is processed.
$url = 'http://home.wi.rr.com/wolfee/Frenn Photo/contactus/thankyou.htm';

// Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty.
$req = '1';

// --------------------------Do not edit below this line--------------------------
$text = "Results from form:\n\n";
$space = ' ';
$line = '
foreach ($_POST as $key => $value)
if ($req == '1')
if ($value == '')
{echo "$key is empty";die;}
$j = strlen($key);
if ($j >= 20)
{echo "Name of form element $key cannot be longer than 20 characters";die;}
$j = 20 - $j;
for ($i = 1; $i <= $j; $i++)
{$space .= ' ';}
$value = str_replace('\n', "$line", $value);
$conc = "{$key}:$space{$value}$line";
$text .= $conc;
$space = ' ';
mail($emailadd, $subject, $text, 'From: '.$emailadd.'');
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';


05-31-2008, 01:56 PM
but the sendresults.php is returned

what do you mean by this

06-01-2008, 03:10 AM
I receive this file which I've changed to text

06-01-2008, 08:56 AM
have you installed PHP and is it working

this indicates that the server is doing what has been asked by serving a .php file when its been requested except the browser does not know what to do with such a file as its an alien format, so offers you the file as a download so you can do what you wish with it. If PHP was installed the server would know that it has to pass any .php requests to the PHP engine and then return HTML after its processed the php instruction

so my question is are you serving it locally or remotely with PHP installed?

06-01-2008, 02:42 PM
I have the PHP file on my ISP's server and I remember changing the request to how I'd like to view this information to a Notepad format. It sounds as though I should change the association of this file to something other than Notepad, maybe back to a browser window. This has worked fine previously but upon making some changes to the htm file I was unable to see the results. When you say "installed" I'm assuming my ISP web space has this installed as its worked before. Any suggestions on what file association to use?


06-01-2008, 02:51 PM
Additionally, I'm not receiving an email nor am I being routed to my thankyou page. Hmmm

06-01-2008, 03:50 PM
it has nothing to do with file association

local file association tells your O/S which program opens which file and its the extension which identifies this. Your browser however reads the contents of whats being sent and renders it to the screen however if the server doesnt recognise the file (php) then it will serve the file directly and the browser will prompt to download

the way to find out if your host has php is to do the following

create a blank file and call it info.php

open the blank file (empty with no HTML) and add the following ...




save it and upload it to the server and browse it through your browser

tell me what you see

06-02-2008, 02:58 PM
It returns the code you suggested within a text document (note pad).

06-02-2008, 08:47 PM
does it prompt for a download?

post url so i can see

06-02-2008, 09:03 PM
It does and then opens Notepad with the php code within.

06-02-2008, 09:05 PM
The URL is http://home.wi.rr.com/wolfee/Frenn/Photo/contactus

06-02-2008, 09:06 PM
so my question is are you serving it locally or remotely with PHP installed? You need to find this out. By the sounds of it, your server does not support PHP.

06-02-2008, 09:07 PM
please edit your post and paste a URL which works

06-03-2008, 04:22 AM
The url is http://home.wi.rr.com/wolfee/Frenn%20Photo/contactus/

06-03-2008, 06:03 AM
that doesnt help

i can guess as before your host does not support php

contact them and ask them

06-07-2008, 12:12 AM
Okay, I've learned my Road Runner server does not support PHP. This site is held by 1and1 and it appears they support PHP. Here's their FAQ http://faq.1and1.com/scripting_languages_supported/php/2.html

I've created the info.php file you suggested and you're welcome to navigate to it by going to http://www.frennphotography.com/contactus/info.php It appears to return a 404 error page.

I've double checked my http://www.frennphotography.com/contactus/index.htm and http://www.frennphotography.com/contactus/sendresults.php (http://www.frennphotography.com/contactus/sendresults.php) code and I'm ready to pull what little hair I have left OUT.

Your help is very much appreciated!!!