Forum Moderators: coopster

Message Too Old, No Replies

Contact Form (From Template Monster)

         

atomage

4:54 am on Sep 27, 2008 (gmt 0)

10+ Year Member



Hi,
I have a template from Template Monster that a client has requested I set up for them. I'm not very knowledgeable with PHP so I hoped someone here could help me out.

I don't know where to put the email address I want the info sent to. Is there any other info I need to change as well to get this to work correctly?

I have two files for the contact form.
Any help would be GREATLY appreciated!

Thanks!

Here is the code in the contact.php file:


<?
Error_Reporting(E_ALL & ~E_NOTICE);
while ($request = current($_REQUEST)) {
if (key($_REQUEST)!='recipient') {
$pre_array=split ("&777&", $request);
$post_vars[key($_REQUEST)][0]=$pre_array[0];
$post_vars[key($_REQUEST)][1]=$pre_array[1];
}
next($_REQUEST);
}
reset($post_vars);
$subject="From ".$post_vars['your_name'][0] ;
$headers= "From: ".$post_vars['your_email'][0] ."\n";
$headers.='Content-type: text/html; charset=iso-8859-1';
$message='';
while ($mess = current($post_vars)) {
if ((key($post_vars)!="i") && (key($post_vars)!="your_email") && (key($post_vars)!="your_name")) {
$message.="<strong>".$mess[1]."</strong>&nbsp;&nbsp;&nbsp;".$mess[0]."<br>";
}
next($post_vars);
}
mail($_REQUEST['recipient'], $subject, "
<html>
<head>
<title>Contact letter</title>
</head>
<body>
<br>
".$message."
</body>
</html>" , $headers);
echo ("Your message was successfully sent!");
?>
<script>
resizeTo(300, 300);
</script>

There is also a contact.asp file with the following code:


<%
for i=1 to 7
message=Request("message")
next
message=message + Request("message")
smtpServer = "enter your SMTP SERVER HERE"
smtpPort = 25
name = Request("Your_Name:")
Set myMail = CreateObject("CDO.Message")
myMail.Subject = "from " & name
myMail.From = Request("Your_Email:")
myMail.To = Request("recipient")
myMail.HTMLBody = "<html><head><title>Contact letter</title></head><body><br>" & message & "</body></html>"
myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtpServer
myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = smtpPort
myMail.Configuration.Fields.Update
myMail.Send
%>

cameraman

8:10 pm on Sep 27, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to Webmaster World, atomage.

The email address is here:
mail($_REQUEST['recipient'], $subject, "

You could change that to a fixed address like
mail('customer@example.com', $subject, "

And I wouldn't automatically send it to any address that's specified from a visitor; otherwise it's just begging for a spambot to come along and send us all thousands of body enhancement emails courtesy your [customer's] site.

Here:
<script>
resizeTo(300, 300);
</script>

I would change it to <script type="text/javascript"> to eliminate the validation error, but it would irritate me when it resized the window so I'd likely remove it altogether.

That other file is for active server pages, vbscript or whatnot.

atomage

1:42 am on Sep 28, 2008 (gmt 0)

10+ Year Member



Thank you for the reply! I will try it out tonight!