...

View Full Version : Godaddy compatible code to autoreply to form mailer email



crocco1980
01-18-2012, 05:14 PM
Hi everyone, Im new to PHP and I've been trying to get my head around some scripts.

Godaddy gives you a script called gdform.php for form mailers but the autoreply isnt set to reply to the email address given in the form. Instead I get an email loop. I'm not sure which changes I need to make to the HTML on my form page (contact.html) and the php. below are the contents of the Godaddy mailer form 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"]."/");
}

?>




This is the HTML code form my form. I obvioulsy want the php code to tell the autoreply to go to the address in the 'mail' field



<form name="contact_form" method="post" action="/gdform.php" onSubmit="return evalid()">
<input type="hidden" name="redirect" value="thankyou.html" />
<table border="0"><tr>
<td>First Name *</td>
<td colspan="2"><input name="fname" type="text" size="30" /></td>
</tr><tr>
<td>Your E-mail *</td>
<td colspan="2"><input type="text" name="mail" size="30" /></td>
</tr><tr>
<td>Phone</td>
<td colspan="2"><input name="phone" type="text" size="30" onkeypress="return numere(event)" onkeyup="return limitarelungime(this, 10)" /></td>
</tr><tr>
<td>Subject *</td>
<td colspan="2"><input name="subject" type="text" size="30" /></td>
</tr><tr>
<td>Message *</td>
<td colspan="2"><textarea name="message" onkeyup="return limitarelungime(this, 500)" cols="35" rows="5"></textarea></td>
</tr><tr>
<td> </td>
<td colspan="2"> </td>
</tr>
<tr>
<td><input type="reset" name="reset" value="Reset"/></td>
<td align="right"><input type="submit" name="Submit" value="Submit"></td><td align="right"><a href="http://www.scriptgenerator.net/71/HTML%7B47%7DPHP-Contact-Form-Mailer-Generator/" title="Valid Contact Form"><img src="http://www.scriptgenerator.net/images/validform.jpg" alt="Valid Contact Form" width="20" height="20" border="0" /></a></td>
</tr>
</table>
</form>



Hope this makes sense. thanks in advance!

GDJames
01-19-2012, 08:56 AM
The script gdform.php and webformmailer.php will only send to the email address that you have set in your Hosting Control Center. You can check out http://support.godaddy.com/help/article/510?isc=SMFOR1 for more info on it. If you need additional flexibility, you are welcome to script your own mailer function as well. Hope this helps.

James R.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum