Page 1 of 1

Form

Posted: Mon Mar 01, 2004 2:58 am
by Stelios
Hi everybody,

I am building my web site and I have created a page where visitors can feedback me by filling in a form and then submiting it to my email address. The form is being processed by a PHP script that I created and it works just fine locally, even sending the email to my eamil address. When I upload it on the server though it doesnt work saying:

Method Not Allowed
The requested method POST is not allowed for the URL /stelios.theodoridis/processform.php.

Apache/1.3.26 Server at homepage.ntlworld.com Port 80


Could anybody give me any clues about it??? My SMTP settings in php.ini are fine, by the way.

Thank you all in advance!

Posted: Mon Mar 01, 2004 3:02 am
by andre_c
If you're paying for hosting, does your hosting company allow for you to send email through scripts? If that's not the problem, can you show some of the code?

Alvaro

Form

Posted: Mon Mar 01, 2004 3:52 am
by Stelios
I am not paying my host, it is my ISP and I am allowed 55MB of free Web Space. I am not sure if I am allowed to run scripts through their server but the fact is that they are giving their SMTP server setting address on their web site, so I suppose you are allowed to do that. Otherwise any ideas of how I can implement this??? By the way here is the code...

<?php
//create short variable names
$nom=$HTTP_POST_VARS['nom'];
$mt=$HTTP_POST_VARS['mt'];
$title=$HTTP_POST_VARS['title'];
$lname=$HTTP_POST_VARS['lname'];
$fname=$HTTP_POST_VARS['fname'];
$pon=$HTTP_POST_VARS['pon'];
$email=$HTTP_POST_VARS['email'];
$feedback=$HTTP_POST_VARS['feedback'];

if (!eregi('^[a-zA-Z0-9_\-\.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$', $email))
{
echo 'This is not a valid email address. Please return to the'
.' previous page and try again.';
exit;
}

if (strlen($feedback)==0)
{
echo ' Please add you comments, to do so, return to the previous page.';
exit;
}

if (strlen($fname)==0)
{
echo 'Please enter your First Name, to do so, return to the previous page.';
exit;
}

if (strlen($lname)==0)
{
echo 'Please enter your Last Name, to do so, return to the previous page.';
exit;
}

$toaddress = 'administrator@pyrford.surrey.sch.uk';
$subject = 'Feedback from web site';
$mailcontent = '<b>Visitor title</b>: '.$title."\n"
.'<b>Visitor First Name</b>: '.$fname."\n"
.'<b>Visitor Last Name: </b>'.$lname."\n"
.'<b>Visitor Email Address: </b>'.$email."\n"
.'<b>Message Type: </b>'.$mt."\n"
.'<b>Nature of Message: </b>'.$nom."\n"
.'<b>Reply: </b>'.$pon."\n"
."<b>Visitor comments: </b>\n".$feedback."\n";
$fromaddress = 'From: Web Site Visitor';

mail($toaddress, $subject, $mailcontent, $fromaddress);
?>

Thanks again

Posted: Mon Mar 01, 2004 11:09 am
by andre_c
On a quick look, I don't see anything wrong with the code, i'm guessing that your isp doesn't allow scripts, mail from script, or something.
Try this

Code: Select all

<?
phpinfo();
?>
and take a look at the php settings.