...

View Full Version : Godaddy Form Help



cmoore
08-01-2007, 10:01 PM
Hello,
I'm a very new recent crash built web master for a company that I'm currently working at. I currently have no knowledge on coding expect the basics of making a very generic page hosted on a web server I've done in class through html. The current problem is that trying to add this code to the page www.paramountrs.com is producing errors or not working correctly. The site is hosted on Godaddy under a windows based server that only uses asp. From what I read is that you have to modify the send button for the email form with (Please excuse the long listings of code being displayed):
<form action="gdform.asp" method="post">

and can modify it further with:

<form action="gdform.asp" method="post">
<input type="hidden" name="subject" value="Form Submission" />
<input type="hidden" name="redirect" value="thankyou.html" />
<p>First Name:<input type="text" name="FirstName" /></p>
<p>Last Name:<input type="text" name="LastName" /></p>
<p>E-Mail:<input type="text" name="email" /></p>
<p>Comments:<textarea name="comments" cols="40" rows="10">
Type comments here.</textarea></p>
<input type="submit" name="submit" value="submit"/>
</form>

Alot of help that is posted that I can find is only through html, which the template I'm using is built is in flash. Currently the send button has this code:

on (rollOver) {
this.gotoAndPlay("s1");
}
on (releaseOutside, rollOut) {
this.gotoAndPlay("s2");
}



on (release) {
for (i=1; i<_parent.fields_descriptions.length; i++) {
if (_parent[_parent.fields_descriptions[i][1]]!=_parent.fields_descriptions[i][2]) {
this[_parent.fields_descriptions[i][1]]=_parent[_parent.fields_descriptions[i][1]]+"&777&"+_parent.fields_descriptions[i][2];
}
_parent.reset_txt(_parent["t"+i], _parent.fields_descriptions[i][1], _parent.fields_descriptions[i][2]);
}

this.recipient=_parent.rec;
i=undefined;
getURL("contact."+_parent.serv, "_blank", "POST");

}

From what I understand from the last tag for get url refers to the pages_contact code which is:

rec="insert email here";
serv="php";

var fields_descriptions= Array ("",
Array("t1", "your_name", "Your Name:"),
Array("t2", "your_email", "Your Email:"),
Array("t3", "telephone", "Telephone:"),
Array("t4", "message", "Message:"),
Array("t5", "field_2", "E-mail:"),
Array("t6", "field_3", "Address:"),
Array("t7", "field_4", "fax:")
);

function reset_txt(name,name2,value) {
path=eval(_target);
path[name2]=value;

this[name].onSetFocus=function() {
path=eval(_target);
if(path[name2]==value) { path[name2]="";}
}

this[name].onKillFocus=function() {
path=eval(_target);
if(path[name2]=="") { path[name2]=value;}
}
}


for (i=1; i<=fields_descriptions.length; i++) {
reset_txt("t"+i, fields_descriptions[i][1], fields_descriptions[i][2]);
}

On the serv= line you can change to asp from php. The strange thing is that the template included its own contact.asp form which is:

<%
for i=1 to 7
message=Request("message")
next
message=message + Request("message")
smtpServer = "enter your SMTP SERVER HERE"
smtpPort = 25


name = Request("Your_Name:")
Set myMail = CreateObject("CDO.Message")
myMail.Subject = "from " & name
myMail.From = Request("Your_Email:")
myMail.To = Request("recipient")
myMail.HTMLBody = "<html><head><title>Contact letter</title></head><body><br>" & message & "</body></html>"
myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtpServer
myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = smtpPort
myMail.Configuration.Fields.Update
myMail.Send

%>

Which you seem to just modify the smtp server and port. Unforuntely godaddy requires me to use their gdform.asp which is:

<%

Dim landing_page, host_url
Dim fso, outfile, filename, dirname, myFolder
Dim req_method, key, value
Dim bErr, errStr, bEmpty
On Error resume next
bErr = false
bEmpty = true
errStr = ""
Set fso = Server.CreateObject("Scripting.FileSystemObject")
host_url = Request.ServerVariables("HTTP_HOST")
req_method = Request.ServerVariables("REQUEST_METHOD")
dtNow = Now()
filename = Server.MapPath("ssfm")
dirname = filename
filename = filename & "/gdform_" & DatePart("M", dtNow) & DatePart("D", dtNow) & DatePart("YYYY", dtNow) & DatePart("N", dtNow) & DatePart("S", dtNow)

Function FormatVariableLine(byval var_name, byVal var_value)
Dim tmpStr
tmpStr = tmpStr & "<GDFORM_VARIABLE NAME=" & var_name & " START>" & vbCRLF
tmpStr = tmpStr & var_value & vbCRLF
tmpStr = tmpStr & "<GDFORM_VARIABLE NAME=" & var_name & " END>"
FormatVariableLine = tmpStr
end function

Sub OutputLine(byVal line)
outfile.WriteLine(line)
end sub

if err.number = 0 then
Set outfile = fso.CreateTextFile(filename, true, false)
if err.number <> 0 then
bErr = true
errStr = "Error creating file! Directory may not be writable or may not exist.<br>Unable to process request."
else
if(req_method = "GET") then
for each Item in request.QueryString
if item <> "" then
bEmpty = false
key = item
value = Request.QueryString(item)
if(lcase(key) = "redirect") then
landing_page = value
else
line = FormatVariableLine(key, value)
Call OutputLine(line)
end if
end if
next
elseif (req_method = "POST") then
for each Item in request.form
if item <> "" then
bEmpty = false
key = item
value = Request.form(item)
if(lcase(key) = "redirect") then
landing_page = value
else
line = FormatVariableLine(key, value)
Call OutputLine(line)
end if
end if
next
end if
outfile.close
end if
if(bEmpty = true) AND errStr = "" then
bErr = true
errStr = errStr & "<br>No variables sent to form! Unable to process request."
end if
if(bErr = false) then
if (landing_page <> "") then
response.Redirect "http://" & host_url & "/" & landing_page
else
response.Redirect "http://" & host_url
end if
else
Response.Write errStr
end if
set fso = nothing
else
Response.Write " An Error Occurred creating mail message. Unable to process form request at this time."
end if
%>

So far I've tried various methods to try to included the gdform.asp from the button to the page_contacts, and last to the contact.asp. All seems to fail and it seems it is probably a very basic understanding of asp is needed to incorporate it to integrate with Godaddy. I been recently gotten to the point looking for some books on amazon to help me out. Thank you so much for reading this post here and hope you can maybe suggest a good coding/web master book to learn from or a method that will allow it to post correctly.

miranda
08-02-2007, 03:53 AM
It looks like the flash has an action of contact.php just find the spot in the flash code where you can change the form's action to contact.asp and change it instead to the name of the GoDaddy asp page.

change the hilighted code shown below


this.recipient=_parent.rec;
i=undefined;
getURL("gdform."+_parent.serv, "_blank", "POST");

}

rec="insert email here";
serv="asp";

cmoore
08-02-2007, 02:17 PM
Thank you for the help miranda. I just implanted the changes and hope it clicks in.

cmoore
08-02-2007, 03:39 PM
Success! The email did send out and after you click on send it opened a new window back on the main page. The email came back a little strange:

To: cmoore@paramountrs.com
Subject: Form submission from paramountrs.com

i: undefined
message: testing&777&Message:
recipient: cmoore@paramountrs.com
your_email: cmoore@paramountrs.com&777&Your Email:
your_name: Charles Moore&777&Your Name:
-----------------------------------------------------------------
This e-mail was generated from a form submission on your website:
paramountrs.com

I'm guessing that its polling the form boxes different then created. I know the name box is your_name, email box is your_email, and the message box is message. This here seems more of coding I'm familiar with from vb 6 basic class. I think that the tags and codes in the pages_contact don't match for gdform.asp, either have to modify it or change the box var names or either the code within pages_contact to match Godaddy. Also gonna try to figure how to add in the:

<input type="hidden" name="subject" value="Form Submission" />
<input type="hidden" name="redirect" value="thankyou.html" />

Into the pages_contact should coincide with the gdform.asp. Wonder if i have to add the email tag refered by this page:
http://help.godaddy.com/article.php?article_id=512

The redirect will be strange since it is flash. It is becoming a very interesting learning experience. Looking into learning a lot more about flash and asp but seems hard without a book going through tutorials.

cmoore
08-02-2007, 10:22 PM
So far been having some compile errors and others. Seems I need more knowledge into the coding before further modifications. I thank you all for reading and the super help that Miranda gave! Can anyone suggest some good starter books on asp/php/web development/flash to get into?

miranda
08-02-2007, 10:47 PM
Lets look at what the GoDaddy code is doing




if err.number = 0 then
Set outfile = fso.CreateTextFile(filename, true, false)
if err.number <> 0 then
bErr = true
errStr = "Error creating file! Directory may not be writable or may not exist.<br>Unable to process request."
else
if(req_method = "GET") then
for each Item in request.QueryString
if item <> "" then
bEmpty = false
key = item
value = Request.QueryString(item)
if(lcase(key) = "redirect") then
landing_page = value
else
line = FormatVariableLine(key, value)
Call OutputLine(line)
end if
end if
next
elseif (req_method = "POST") then
for each Item in request.form
if item <> "" then
bEmpty = false
key = item
value = Request.form(item)
if(lcase(key) = "redirect") then
landing_page = value
else
line = FormatVariableLine(key, value)
Call OutputLine(line)
end if
end if
next
end if
outfile.close
end if
if(bEmpty = true) AND errStr = "" then
bErr = true
errStr = errStr & "<br>No variables sent to form! Unable to process request."
end if
if(bErr = false) then
if (landing_page <> "") then
response.Redirect "http://" & host_url & "/" & landing_page
else
response.Redirect "http://" & host_url
end if
else
Response.Write errStr
end if
set fso = nothing
else
Response.Write " An Error Occurred creating mail message. Unable to process form request at this time."
end if



this part is checking to see if it can use the FileSystemObject to create a text file. Then if it can it is checking to see which method the form's method attribute is using - GET or POST. Then dependant on the method it is using, a for each loop is used to loop through each and every one of the form's elements, independant of what they are named, and regardless of how many there are. Since you have the hidden form elements that aren't being passed I would then ask you if they are part of the flash? If not then that would be why they don't show up.


BTW if you know VB6 at all you can code asp You just need to remember that this is vbScript so not everything is available. Also remember that this is a client server environment so things like msgbox do not work. (because the code is running on the server any messages sent using the msgbox function will display on the server)


Also you really should use the code tags so that the formating stays in place (my biggest peeve is code that is not indented properly -- [I have been working with a lot of legacy code at work lately and when there is 5-10,000 lines of un indented code it makes it a real pain :mad: ])

cmoore
08-03-2007, 05:25 PM
I'm current using Flash CS3 to modify the flash template.The software is very new to me but easy to adapt expect for action scripting and similar. The hidden form elements are not currently in the flash, trying to insert them in. It gives me errors when trying both send button or pages_contact. My current knowledge of VB6 only comes from one class in intro to computer programming. Which mostly consisted of small projects and basic coding and functions. For the codes tags for formatting sounds great, will add it to the modify list. I need a lot more into coding to better understand more then what I learned from class. I never used any of the Adobe programs before. But thank you for replying and explaining about the code, it helps out tremendously.

miranda
08-04-2007, 07:56 PM
If you can edit the flash template then you should be able to add your 2 hidden fields. Perhaps a post on the flash board will help you add them?

Once you have added the hidden fields you are done. This is because the GoDaddy asp code uses a for each next loop to process the items coming in from the form so you do not have to do anything with it.

As to good books I don't know of anything new since 3 generations of asp have come out since this version did. (This is asp 3.0 also referred to as classic asp) You may have to hit a used book store to find something on asp 3.0. I taught myself by reading a Sams teach yourself asp book and also the books that were included with my old version of Visual Studio 6. Your having had that single intro class in VB set a good foundation since you know the basics of coding in VB.

There are multiple sites on the web that can help you learn. W3 Schools (http://www.w3schools.com/asp/default.asp)is a good site to learn asp from as is 4guysfromrolla (http://www.4guysfromrolla.com/webtech/index_asp.shtml) stick to articles written before 2002 as pretty much anything newer is about Asp.Net

then there is also learnasp.com (http://www.learnasp.com/freebook/asp/) i have linked to the classic asp stuff for you since once again all of the new content is about asp.net

cmoore
08-08-2007, 02:32 PM
Thank you for all you did miranda! Sorry for the late reply lots of issues and projects make me run everywhere, will try the flash board. The sites you have gave me are helping out good. I did find some books to help out. I'm figuring out more somewhat of why I'm getting compile errors.

Adement
08-11-2008, 11:26 PM
Well I am trying to do the same thing. the flash does call a asp and a php file. I am fairly new to this so I really have no clue what I should change in the script in order for it to work.

Here are the codes for each respective. would appreciate any help that can be offered. Thank you. My site is Aaron-DeMent.com
//php//

<?
Error_Reporting(E_ALL & ~E_NOTICE);

while ($request = current($_REQUEST)) {
if (key($_REQUEST)!='recipient') {
$pre_array=split ("&777&", $request);
$post_vars[key($_REQUEST)][0]=$pre_array[0];
$post_vars[key($_REQUEST)][1]=$pre_array[1];
}
next($_REQUEST);
}



reset($post_vars);


$subject="From ".$post_vars['your_name'][0] ;
$headers= "From: ".$post_vars['your_email'][0] ."\n";
$headers.='Content-type: text/html; charset=iso-8859-1';
$message='';
while ($mess = current($post_vars)) {
if ((key($post_vars)!="i") && (key($post_vars)!="your_email") && (key($post_vars)!="your_name")) {

$message.="<strong>".$mess[1]."</strong>&nbsp;&nbsp;&nbsp;".$mess[0]."<br>";
}
next($post_vars);
}

mail($_REQUEST['recipient'], $subject, "
<html>
<head>
<title>Contact letter</title>
</head>
<body>
<br>
".$message."
</body>
</html>" , $headers);
echo ("Your message was successfully sent!");

?>
<script>
resizeTo(300, 300);
</script>



//ASP//
<%
for i=1 to 7
message=Request("message")
next
message=message + Request("message")
smtpServer = "smtp.secureserver.net"
smtpPort = 25


name = Request("Your_Name:")
Set myMail = CreateObject("CDO.Message")
myMail.Subject = "from " & name
myMail.From = Request("Your_Email:")
myMail.To = Request("recipient")
myMail.HTMLBody = "<html><head><title>Contact letter</title></head><body><br>" & message & "</body></html>"
myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtpServer
myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = smtpPort
myMail.Configuration.Fields.Update
myMail.Send

%>

Spudhead
08-12-2008, 12:21 PM
Hi Adement. Couple of suggestions:

1. If you've got a question of your own, start a thread. By all means reference existing ones if you think they're relevant, but adding your question to the bottom of an existing one reduces your chances of someone seeing it.

2. Put code into [ CODE ] brackets. You'd be amazed how much easier it is to read.

3. Can you explain a bit more what you're trying to do with this code? You've got a Flash form, that posts data to... an ASP file? A PHP file? Could you describe what you're trying to do, and what is actually happening?

Adement
08-20-2008, 01:22 AM
The contact form is embedded in a swf, and then the code references the asp and php to spit out an email to me once the contact for is filled out. It is a standard contact form

Name:
Email:
Subject:
Comments:


But even when I change the receiver to my email address and the smtp to the godaddy server it still doesn't generate an email to me. The PHP cycles through and sends the popup "mail sent" but nothing ever comes to me.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum