PDA

View Full Version : php form!


nclara_pt
09-15-2006, 04:30 PM
I followed this tutorial:
http://www.dreamweaverclub.com/dreamweaver-php-form.php

and i hosted the website...

however when i tested it ... i put the information in the box and when i tried to send it to my email it appeared an error:

"Method Not Allowed
The requested method POST is not allowed for the URL /sendresults.php."

i made it exaclty as in the tutorial...


<?php
//--------------------------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 = 'xxxxxx@hotmail.com';

// Where to redirect after form is processed.
$url = 'http://secretdi.tripod.com/Untitled-2.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 = '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.'">';
?>

anyone can help me?

(sorry for my bad english =/ )

Creative Insanity
09-15-2006, 07:55 PM
Make sure your hoster is not blocking any php commands. I was on a hoster that use to block the mail php function and that cost me hours trying to fix something that was not broken.

I have used that script many times and I assure you it does work, very nicely indeed.