Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-18-2012, 05:14 PM   PM User | #1
crocco1980
New to the CF scene

 
Join Date: Jan 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
crocco1980 is an unknown quantity at this point
Godaddy compatible code to autoreply to form mailer email

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:

Code:
 
<?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

Code:
 
<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!
crocco1980 is offline   Reply With Quote
Old 01-19-2012, 08:56 AM   PM User | #2
GDJames
New to the CF scene

 
Join Date: Jan 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
GDJames is an unknown quantity at this point
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.
GDJames is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:35 PM.


Advertisement
Log in to turn off these ads.