PDA

View Full Version : Help with changing GoDaddy's default sort order???


JessicaB
12-09-2006, 06:22 PM
Pleeease help! I am hosting several sites with GoDaddy which use their own php mail forms. GoDaddy has their server set to sort variables in alphabetical order by deafault. This is a nightmare for me and I cannot figure out how to set custom sort orders. Can someone please tell me how to fix it so when the variable are emailed to me things will appear in the order I want them to? Such as First Name, Last Name, Address, and so on? I would reeeeally appreciate it!

guelphdad
12-09-2006, 06:52 PM
so do you have acess to the code? i'm not familiar with godaddy. if you have access to the code though you should be able to change the mail portion to order the fields in whatever way you want.

JessicaB
12-09-2006, 06:55 PM
<?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");
$fp = fopen("../data/gdform_$t","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"]."/");
}


?>

JessicaB
12-09-2006, 06:56 PM
I am not sure what to edit or what to insert here. I am just barely learning php. Thanks for the help!

guelphdad
12-09-2006, 07:01 PM
actually then you won't edit anything there, this part of the code basically says to step through each variable in turn:

while (list ($key, $val) = each ($query_vars))

so you would change the order of your form.

May I ask why it matters to you what order things are sent to you in? what are you trying to do from the point of the email that the order would matter?

JessicaB
12-09-2006, 07:11 PM
I actually do have my form in the order I want the variable in. But, GoDaddy's server automatically puts everything in alphabetical order. I contacted them and they said that is the default of their server.

The form is an order form in which the user can order a customized home mailbox. It is extremely difficult and time consuming to process an order when contact info is mixed up with the specifications of the mailbox design and such. I need to keep everything together.

This is what I get in emails from the form:

Aluminum_post_color: None
Billing_Address1:
Billing_Address2:
Billing_City:
Billing_Name:
Billing_State:
Billing_Zip:
Cost_installation:
Cost_mailbox:
Cost_post:
Cost_sales_tax:
Cost_shipping:
Cost_subtotal:
Install_E-Mail: sadfdf
Install_FAX:
Install_address1: sffdf
Install_address2: asdfd
Install_city: asdfad
Install_day_phone: sdfda
Install_evening_phone: sdfd
Install_name: testing from JB
Install_state: oh
Install_zip: 654654
Keystone_color: None
Keystone_post_color: None
Laminated_Post_Size: None
Laminated_Post_Style: one
Laminated_post_color: None
Lettering_Color: Green
Lettering_Type_Style: Baskerville
Lettering_layout: Layout #2
Mr__Mailbox_color: Green
Payment_Acct__Number:
Payment_Card_Exp__Date:
Post_lnstallation_Location: Where to install the new post
Special_Info_Requests: test
StatementAddress:
Statement_City:
Statement_State:
Statement_Zip:
VR_color: None
VR_size: None
Veeders_size: None
mailbox_model: Mr. Mailbox Special
recipient: info@mrmailbox.com
requiredCost_total: 10

JessicaB
12-09-2006, 07:15 PM
Here is the first part of the code I have in my HTML page. Everything after that is not in alphabetical order, but how I want it to show up.


<form name="Quiry Form" method="post" action="http://www.jessicabynon.com/gdform.php" onSubmit="return checkrequired(this)">
<form method="get" action="http://www.jessicabynon.com/gdform.php">

<input type="hidden" name="recipient" value="info@mrmailbox.com">
<input type="hidden" name="redirect" value="MrMailbox/FinalDesign/thankyou.html">
<input type="hidden" name="subject" value="Mr. Mailbox Order">

JessicaB
12-09-2006, 07:24 PM
I would like to be able to make this work with a template, but can't seem to get that to work either. I added this code to the HTML page and uploaded the text file, but it made no difference in the outcome.


<input type="hidden" name="sortOrder" value="_template">
<input type="hidden" name="templatefile" value="http://www.jessicabynon.com/temp/mrmailbox/form_template.txt">

CFMaBiSmAd
12-09-2006, 07:54 PM
The code you posted writes the information to a file - ../data/gdform_$t, where $t is a time stamp. Forms and the posted code leave the fields in the order that they are in the HTML form (in fact I just tried the posted code to confirm this.) Have you examined one of the resultant ../data/gdform_xxxxxxxxxxx files to see what order the data is. I suspect that the code that takes the content of these files and formats the email is where the order is being changed.

Is there any published documentation that you can provide a link to on how this scheme is supposed to work?

JessicaB
12-09-2006, 08:57 PM
The code you posted writes the information to a file - ../data/gdform_$t, where $t is a time stamp. Forms and the posted code leave the fields in the order that they are in the HTML form (in fact I just tried the posted code to confirm this.) Have you examined one of the resultant ../data/gdform_xxxxxxxxxxx files to see what order the data is. I suspect that the code that takes the content of these files and formats the email is where the order is being changed.

Is there any published documentation that you can provide a link to on how this scheme is supposed to work?

I am not quite sure I understand what you are saying. Keep in mind, I am a newbie to PHP for the most part. Take a look at what GoDaddy says in their PHP mail form FAQ. Note the yellow box which says "NOTE: Keep in mind that our form-mailer script will sort the names of your form items alphabetically when it composes the email message. This is the order of precedence: uppercase letters, lowercase letters, numbers."

http://help.godaddy.com/article.php?article_id=510&topic_id=&&

Does this help any?

JessicaB
12-09-2006, 08:59 PM
Also, this is the order that I want the email to list the variables in, which is not what it is doing...

$recipient
$subject
$Install_name
$Install_address1
$Install_address2
$Install_city
$Install_state
$Install_zip
$Install_day_phone
$Install_evening_phone
$Install_FAX
$Install_E-Mail
$mailbox_model
$Keystone_color
$Mr._Mailbox_color
$VR_color
$VR_size
$Veeders_size
$Lettering_layout
$Lettering_Type_Style
$Lettering Color
$post
$Aluminum_post_color
$Keystone_post_color
$Laminated_Post_Style
$Laminated_post_color
$Laminated_Post_Size
$Post_lnstallation_Location
$Cost_mailbox
$Cost_post
$Cost_installation
$Cost_subtotal
$Cost_sales_tax
$Cost_shipping
$requiredCost_total
$Billing_Name
$Billing_Address1
$Billing_Address2
$Billing_City
$Billing State
$Billing_Zip
$Payment_Method
$Payment_Acct._Number
$Payment_Card_Exp._Date
$StatementAddress
$Statement_City
$Statement_State
$Statement_Zip
$Special_Info_Requests

CFMaBiSmAd
12-09-2006, 09:06 PM
If you can only use their form/mailer code to send email, you would need to name the fields to achieve the results you want - perhaps add f01_, f02_, f03_ prefixes...

Otherwise, you would need to get/write your own form to mail processing code.

JessicaB
12-09-2006, 09:13 PM
The php code I listed earlier is, in fact, their auto generated php form. I do have the abillity to change the code to an extent, but I just don't know what to change to get the desired result. I wasn't sure if the php code needs changed or if the form in the HTML file needs to be changed?

Let's say that you have an HTML form which uses the php code listed above. If you wanted to alter that specific php code to sort the variables in a specified order, how would you alter the code and what would be the resulting new code?

I have been using numerical prefixes up to this point to achieve the desired ordering, but I can't stand it. If there is another way, that's what I want to shoot for.