Hey guys, I'm using the gdform.php script provided by godadddy, it's their form mailer. Like most form mail scripts it grabs the name attribute of a field and displays that in the email as the title.
example email:Entity: Business
First: Timothy
Inquiry: Pricing
Last: Anderson
here's the script:
<?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'] . "\ssfm\gdform_" . $t;
$fp = fopen($file,"w");
while (list ($key, $val) = each ($query_vars))
{
fputs($fp,"<GDFORM_VARIABLE NAME=$key START>\r\n");
fputs($fp,"$val\r\n");
fputs($fp,"<GDFORM_VARIABLE NAME=$key END>\r\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"]."/");
}
?>
- <?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'] . "\ssfm\gdform_" . $t;
- $fp = fopen($file,"w");
-
- while (list ($key, $val) = each ($query_vars))
- {
- fputs($fp,"<GDFORM_VARIABLE NAME=$key START>\r\n");
- fputs($fp,"$val\r\n");
- fputs($fp,"<GDFORM_VARIABLE NAME=$key END>\r\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"]."/");
- }
- ?>
The problem with this script is that it's proprietary to godaddy so I can't change any of it otherwise godaddy relays an error.
I have a couple question:
First off, it's changing the fields around before it sends out the email. Is there a way to control which order they go? I'd like them to be sent to the email in the order that my form is set up.
My form (abridged):
<form action="gdform.php" method="post" style="margin-left: 20px;" name="contactform">
<input type="hidden" name="subject" value="subject" id="contactform" />
<input type="hidden" name="redirect" value="thankyou.html" />
First Name:
<input type="text" name="First" />
Last Name:
<input type="text" name="Last" />
E-Mail:<input type="text" name="Email" />
Entity:
<input type="radio" name="Entity" value="Business" />Business<br />
<input type="radio" name="Entity" value="Residential" />Residential
Inquiry:
<select name="Inquiry" id="inquire">
<option>Service Area</option>
<option>Pricing</option>
<option>Promotions</option>
<option>Appointment</option>
<option>Other</option>
</select>
Comments:
<textarea name="Comments" cols="50" rows="7" onfocus="subjectChange();"></textarea>
<input type="submit" name="submit" value="submit" />
</form>
- <form action="gdform.php" method="post" style="margin-left: 20px;" name="contactform">
- <input type="hidden" name="subject" value="subject" id="contactform" />
- <input type="hidden" name="redirect" value="thankyou.html" />
- First Name:
- <input type="text" name="First" />
- Last Name:
- <input type="text" name="Last" />
- E-Mail:<input type="text" name="Email" />
- Entity:
- <input type="radio" name="Entity" value="Business" />Business<br />
- <input type="radio" name="Entity" value="Residential" />Residential
- Inquiry:
- <select name="Inquiry" id="inquire">
- <option>Service Area</option>
- <option>Pricing</option>
- <option>Promotions</option>
- <option>Appointment</option>
- <option>Other</option>
- </select>
- Comments:
- <textarea name="Comments" cols="50" rows="7" onfocus="subjectChange();"></textarea>
- <input type="submit" name="submit" value="submit" />
- </form>
also, if you notice in the comments field, I have an event handler that isn't working. I want to change the subject to whatever is selected in the inquiry drop-down list.
javascript code:
<!--
function subjectChange(){
var initSubject = document.getElementById("contactform").value;
var selectInquire = document.getElementById("inquire").selectedIndex;
document.getElementById("contactform").value = selectInquire;
return true;
}
// -->
- <!--
- function subjectChange(){
- var initSubject = document.getElementById("contactform").value;
- var selectInquire = document.getElementById("inquire").selectedIndex;
- document.getElementById("contactform").value = selectInquire;
- return true;
- }
- // -->
any ideas? Whenever I submit an email through this form the subject reads "subject" without the quotes of course. Point is it's not changing at all. I've tried calling this function with onsubmit placed in the form tag and on the button tag, as well as the onfocus in the Inquiry and comments fields.
I tried a few searches on the forum but couldn't find anything. I'm not too great at javascript so it's hard for me to interpret something as similar to my problem or not.
Use your words like arrows to shoot toward your goal.