Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I am not a coder, I have some code that allows a user to send an email via a Form. I have used the code on a couple of sites with no trouble
It goes from a contact form, click submit , this will take it to send.php then it will either take it to error.htm or success.htm
I have just tried to use it in another site and when I ckick submit it takes me to send.php whith a "page not available" message and the send.php page will open on my computer in dreamweaver.
this is the code for the contact form
[syntax="html"]<form name="form1" method="post" action="send.php">
<table width="600" border="0" cellspacing="10" cellpadding="0">
<tr>
<td class="Normal"><div align="right"></div></td>
<td><div align="left">
<p class="Head">Contact Us </p>
</div></td>
</tr>
<tr>
<td class="Normal"><div align="right"><span class="red">*</span>Name</div></td>
<td><div align="left">
<input name="Name" type="text" id="Name">
</div></td>
</tr>
<tr>
<td class="Normal"><div align="right"><span class="red">*</span>Email</div></td>
<td><div align="left">
<input name="Email" type="text" id="Email">
</div></td>
</tr>
<tr>
<td valign="top" class="Normal"><div align="right">Comments</div></td>
<td><div align="left">
<textarea name="Comment" cols="50" rows="10" id="Comment"></textarea>
</div></td>
</tr>
<tr>
<td class="Normal"><div align="right">
<input type="submit" name="Submit" value="Submit">
</div></td>
<td><div align="left">
<input name="Reset" type="reset" id="Reset" value="Reset">
</div></td>
</tr>
</table>
</form>Then the send.php code[/syntax]
Code: Select all
<?PHP
error_reporting(7);
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ClientIP = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$ClientIP = $_SERVER['REMOTE_ADDR'];
}
# RegisterGlobals OFF
$FTGName = $_POST['Name'];
$FTGEmail = $_POST['Email'];
$FTGComment = $_POST['Comment'];
$FTGSubmit = $_POST['Submit'];
$FTGReset = $_POST['Reset'];
if (get_magic_quotes_gpc) {
$FTGName = stripslashes($FTGName);
$FTGEmail = stripslashes($FTGEmail);
$FTGComment = stripslashes($FTGComment);
$FTGSubmit = stripslashes($FTGSubmit);
$FTGReset = stripslashes($FTGReset);
}
# Redirect user to the error page
if ($validationFailed == true) {
header("Location: error.htm");
exit;
}
# Email to Form Owner
$emailTo = '"" <myemail@yahoo.com.au>';
$emailSubject = "From website";
$emailSubject = preg_replace('/[\x00-\x1F]/', '', $emailSubject);
$emailFrom = "$FTGEmail";
$emailFrom = preg_replace('/[\x00-\x1F]/', '', $emailFrom);
$emailHeader = "From: $emailFrom\n"
. "Reply-To: $emailFrom\n"
. "MIME-Version: 1.0\n"
. "Content-Type: multipart/alternative; boundary="FTG_BOUNDRY"\n"
. "X-Sender: $emailFrom\n"
. "X-Mailer: PHP\n"
. "X-Priority: 3\n"
. "Return-Path: $emailFrom\n"
. "\n";
$emailBody = "--FTG_BOUNDRY\n"
. "Content-Type: text/plain; charset="ISO-8859-1"\n"
. "Content-Transfer-Encoding: 8bit\n"
. "\n"
. "Name: $FTGName\n"
. "Email: $FTGEmail\n"
. "Comment: $FTGComment\n"
. "Submit: $FTGSubmit\n"
. "Reset: $FTGReset\n"
. "\n"
. ""
. "\n"
. "--FTG_BOUNDRY\n"
. "Content-Type: text/html; charset="ISO-8859-1"\n"
. "Content-Transfer-Encoding: base64\n"
. "\n"
. chunk_split(base64_encode("<HTML>\n"
. "<head>\n"
. "<title></title>\n"
. "</head>\n"
. "<body>\n"
. "<table width="500" border="0" cellspacing="0" cellpadding="3">\n"
. " <tr>\n"
. " <td width="150"><div align="right"><b><font face="Tahoma" size="2">Name:</font></b></div></td>\n"
. " <td width="336"><font face="Tahoma" size="2">$FTGName</font></td>\n"
. " </tr>\n"
. " <tr>\n"
. " <td width="150"><div align="right"><b><font face="Tahoma" size="2">Email:</font></b></div></td>\n"
. " <td><font face="Tahoma" size="2">$FTGEmail</font></td>\n"
. " </tr>\n"
. " <tr>\n"
. " <td width="150"><div align="right"><b><font face="Tahoma" size="2">Comment:</font></b></div></td>\n"
. " <td><font face="Tahoma" size="2">$FTGComment</font></td>\n"
. " </tr>\n"
. "</table></body></html>\n"
. "\n"
. ""))
. "\n"
. "--FTG_BOUNDRY--";
mail($emailTo, $emailSubject, $emailBody, $emailHeader);
# Redirect user to success page
header("Location: success.htm");
exit;
# End of PHP script
?>If any one can help it would be much appreciated
Thank you
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
[quote="[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1"][b]1.[/b] Select the correct board for your query. Take some time to read the guidelines in the sticky topic.[/quote]