View Full Version : form to email using the php tutorial

03-22-2011, 10:16 PM
I followed the form to email tutorial in The tutorial an Articles page but it still does not work can you help the webspace host supports php 5.3.5 is there something else I should be doing.
Thakyou gaham brooks

03-22-2011, 10:49 PM
I take it that you've uploaded this to your server?

If so can you provide a link to the page and the code that you have in your php script.

Then we can help.

03-22-2011, 11:02 PM
Yes I have uploaded the site here is the php script
<!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=utf-8" />
<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 = 'email@hotmail.co.uk';
// Where to redirect after form is processed.
$url = 'http://www.grahamswebdesign/confirmation.html';
// 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 = '0';
// --------------------------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.'">';

03-23-2011, 01:14 AM
whats the form and phpscript url?

03-23-2011, 07:52 AM
www.grahamswebdesign.co.uk/contacts (http://www.grahamswebdesign.co.uk/contacts) is the form url and I called the php as sendresults.php I cut and pasted the php code from the tutorial int a php file and of course edited what I was told to I am just experimenting at the moment so I followed the tutorial almost to the letter but there must be somerhing I am not doing or doing wrong becuase there is no sign of the form details to e-mail add or anywhere. the properties are set form id contact form action:www.grahamswebdesign.co.uk/sendresults, method post

03-23-2011, 08:00 AM
The requested URL /www.grahamswebdesign/sendresults.php was not found on this server.
but in any case when you upload it make the action of the form
sendresults.php, it is possble the server will block this