wacka2
11-01-2007, 08:21 PM
Hi, I'm new to this forum and to PHP. I've been scouring the net for a couple of days hoping to find my answer but without luck.
I host a few websites under one main account at godaddy.com. I'd like to be able to have each website have its own formmail and have the results be sent to different recipients. In order to do this, godaddy suggested using PHP. Otherwise, all results get sent to one email address that you set under preferences.
I've been able to get the form to work beautifully on one of my subaccounts but I'm having a hell of a time trying to figure out where to specify the email address. I thought I could add this to the existing gdform.php (which I've renamed mailer.php):
$to = "myemail@gmail.com";
$subject = "Form";
...but the email still gets delivered to the main address. Here's the original gdform.php:
<?php
$request_method = $_SERVER["REQUEST_METHOD"];
if($request_method == "GET"){
$query_vars = $_GET;
} elseif ($request_method == "POST"){
$query_vars = $_POST;
}
reset($query_vars);
$t = date("U");
$file = $_SERVER['DOCUMENT_ROOT'] . "/../data/gdform_" . $t;
$fp = fopen($file,"w");
while (list ($key, $val) = each ($query_vars)) {
fputs($fp,"<GDFORM_VARIABLE NAME=$key START>\n");
fputs($fp,"$val\n");
fputs($fp,"<GDFORM_VARIABLE NAME=$key END>\n");
if ($key == "redirect") { $landing_page = $val;}
}
fclose($fp);
if ($landing_page != ""){
header("Location: http://".$_SERVER["HTTP_HOST"]."/$landing_page");
} else {
header("Location: http://".$_SERVER["HTTP_HOST"]."/");
}
?>
Godaddy's only instructions for me were to 1) put the .php file in the root folder of the subaccounts and 2) make sure I specify their relay server in a custom script. I've found this server information in a .ini file. Which file do I alter and where should the code be inserted?
Any kind of help would be greatly, greatly appreciated!
I host a few websites under one main account at godaddy.com. I'd like to be able to have each website have its own formmail and have the results be sent to different recipients. In order to do this, godaddy suggested using PHP. Otherwise, all results get sent to one email address that you set under preferences.
I've been able to get the form to work beautifully on one of my subaccounts but I'm having a hell of a time trying to figure out where to specify the email address. I thought I could add this to the existing gdform.php (which I've renamed mailer.php):
$to = "myemail@gmail.com";
$subject = "Form";
...but the email still gets delivered to the main address. Here's the original gdform.php:
<?php
$request_method = $_SERVER["REQUEST_METHOD"];
if($request_method == "GET"){
$query_vars = $_GET;
} elseif ($request_method == "POST"){
$query_vars = $_POST;
}
reset($query_vars);
$t = date("U");
$file = $_SERVER['DOCUMENT_ROOT'] . "/../data/gdform_" . $t;
$fp = fopen($file,"w");
while (list ($key, $val) = each ($query_vars)) {
fputs($fp,"<GDFORM_VARIABLE NAME=$key START>\n");
fputs($fp,"$val\n");
fputs($fp,"<GDFORM_VARIABLE NAME=$key END>\n");
if ($key == "redirect") { $landing_page = $val;}
}
fclose($fp);
if ($landing_page != ""){
header("Location: http://".$_SERVER["HTTP_HOST"]."/$landing_page");
} else {
header("Location: http://".$_SERVER["HTTP_HOST"]."/");
}
?>
Godaddy's only instructions for me were to 1) put the .php file in the root folder of the subaccounts and 2) make sure I specify their relay server in a custom script. I've found this server information in a .ini file. Which file do I alter and where should the code be inserted?
Any kind of help would be greatly, greatly appreciated!