Hello, I'm a php newbie and have been using the following php code fine
(until now) to submit a form and create an email message. I recently
moved the site from a local server to an ISP's server and now, whenever
I attempt to submit the form, the entries I made are cleared and no
e-mail is sent.
I have no idea what the problem is - can anyone help?
------------begin extracted php---------------
<?php
if ($_SERVER['REQUEST_METHOD '] != 'POST'){
$me = $_SERVER['PHP_SELF'];
print <<<TOEND
<form name="form1" method="post" action="$me">
Name: <input type="text" name="Name">
Subject: <input type="text" name="Subject"> </td>
Message: <textarea name="MsgBody"> </textarea></td>
<input type="submit" name="Submit" value="Send"></td>
</form>
TOEND;
} else {
error_reporting (0);
$recipient = 'alan@innovez.c o.uk';
$subject = stripslashes($_ POST['Subject']);
$from = stripslashes($_ POST['Name']);
$msg = "Message from: $from\n\n".stri pslashes($_POST['MsgBody']);
if (mail($recipien t, $subject, $msg))
echo nl2br("<b>Messa ge Sent:</b>
To: $recipient
Subject: $subject
Message:
$msg");
else
echo "Message failed to send";
}
?>
------------end extracted php---------------
(until now) to submit a form and create an email message. I recently
moved the site from a local server to an ISP's server and now, whenever
I attempt to submit the form, the entries I made are cleared and no
e-mail is sent.
I have no idea what the problem is - can anyone help?
------------begin extracted php---------------
<?php
if ($_SERVER['REQUEST_METHOD '] != 'POST'){
$me = $_SERVER['PHP_SELF'];
print <<<TOEND
<form name="form1" method="post" action="$me">
Name: <input type="text" name="Name">
Subject: <input type="text" name="Subject"> </td>
Message: <textarea name="MsgBody"> </textarea></td>
<input type="submit" name="Submit" value="Send"></td>
</form>
TOEND;
} else {
error_reporting (0);
$recipient = 'alan@innovez.c o.uk';
$subject = stripslashes($_ POST['Subject']);
$from = stripslashes($_ POST['Name']);
$msg = "Message from: $from\n\n".stri pslashes($_POST['MsgBody']);
if (mail($recipien t, $subject, $msg))
echo nl2br("<b>Messa ge Sent:</b>
To: $recipient
Subject: $subject
Message:
$msg");
else
echo "Message failed to send";
}
?>
------------end extracted php---------------
Comment