Reply
Requesting Data field info from the html page
Old 05-21-2007, 03:55 PM Requesting Data field info from the html page
Mr.Douks's Avatar
Novice Talker

Posts: 9
Name: Andre
Location: ATL, Georgia. USA
I have a html page that contains a form. The forms text fields have the specific name. i.e. "emailaddress"

These are sections of the code, i just needed help on the format.

//in my asp code i have

strAddress = Request.Querystring ("emailaddress")

//then i have
strMsg = "Email Address: " & strAddress

//then
MyMail.Body = strMsg

<-- But when the mail arrived in my inbox it only has the text that are in the quote

i.e. Email Address:

????not sure where to go from here.
Already tried removing the "str" from strAddress = Request.......
and removing the "str" from strMsg = "Email Address:" & (str)Address

can anyone help me..

~MR. Douks
Mr.Douks is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Old 05-21-2007, 06:18 PM Re: Requesting Data field info from the html page
chrishirst's Avatar
Super Moderator

Posts: 12,752
Location: Blackpool. UK
Basic debugging.

is emailaddress passed in the querystring or in a form?

response.write the values to see if the are what you think they should be

Other than that, absolutely no idea

We can't see your code and we can't see your page(s) with the problem.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 05-21-2007, 08:26 PM Re: Requesting Data field info from the html page
Mr.Douks's Avatar
Novice Talker

Posts: 9
Name: Andre
Location: ATL, Georgia. USA
&lt.asp>
<head>
<title>ADS Graphics Firm Email Form</title>
<meta http-equiv="Content-Type" content="text.asp; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF" text="#000000">

<%
Dim strFrom, strAddress, strPhone, strContact, strPrjectbudget, strCurrent, strPages, strMState, strProjecttype, strMDescription
strFrom = Request.Querystring("contactname")
strAddress = Request.Querystring("emailaddress")
strPhone = Request.Querystring("phonenumber")
strContact = Request.Querystring("timecontact")
strProjectbudget = Request.Querystring("projectbudget")
strCurrent = Request.Querystring("currentsiteavailable")
strPages = Request.Querystring("pagesforsite")
strMState = Request.Querystring("location")
strProjecttype = Request.Querystring("projecttype")
strMDescription = Request.Querystring("projectdescription")


Dim MyMail
Set MyMail = Server.CreateObject("CDONTS.NewMail")
MyMail.to=" invalid@tester.com"
MyMail.Subject = strProjecttype
MyMail.from = "invalid@tester.com"
strMsg = "Contact Name: " & strFrom & vbCrLf & "Email Address: " & strAddress & vbCrLf & "Contact Number: " & strPhone & vbCrLf & "Contact Time: " & strContact & vbCrLf & "Project Budget: " & strProjectbudget & vbCrLf & "Current Site: " & strCurrent & vbCrLf & "Estimated Pages: " & strPages & vbCrLf & "Location: " & strMState & vbCrLf & "Project Type: " & strProjecttype & vbCrLf & "Project description: " & strMDescription & vbCrLf
MyMail.Body = strMsg
MyMail.BodyFormat = 0
MyMail.MailFormat = 0
MyMail.Importance = 2
MyMail.Send
Set MyMail=nothing
%>

Your email has been sent.

<script language="Javascript">
alert ("Your email has been delivered successfully, Thank you.")
location = "Contact.htm"
</script>
</body>
%>

/////in the html form i have the NAME of the text box as "emailaddress"
I was under the impression that the Request.Querystring was a command that took the string from the html form via a request.
Not sure, obviously though.
I'm just getting into the "form" world.
__________________
~Mr. Douks~
Mr.Douks is offline
Reply With Quote
View Public Profile
 
Old 05-22-2007, 02:14 AM Re: Requesting Data field info from the html page
chrishirst's Avatar
Super Moderator

Posts: 12,752
Location: Blackpool. UK
Quote:
I was under the impression that the Request.Querystring was a command that took the string from the html form via a request.
It depends.
If you use GET as the form action the form elements will be passed in the URL and request.querystring will collect the key/value pair.
If you POST the form, you collect the elements with request.form.

Request Collection
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 05-22-2007, 02:14 PM Re: Requesting Data field info from the html page
Mr.Douks's Avatar
Novice Talker

Posts: 9
Name: Andre
Location: ATL, Georgia. USA
****************************
THIS IS WHAT I HAVE
***************************
****************************
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
Option Explicit
Response.Expires = 0

Dim strFrom
Dim strEmail
Dim strPhone
Dim strContact
Dim strProjectbudget
Dim strCurrent
Dim strPages
Dim strMState
Dim strProjecttype
Dim strMDescription


strFrom = Trim(Request.Form("contactname"))
strEmail = Trim(Request.Form("emailaddress"))
strPhone = Trim(Request.Form("phonenumber"))
strContact = Trim(Request.Form("timecontact"))
strProjectbudget = Trim(Request.Form("projectbudget"))
strCurrent = Trim(Request.Form("currentsiteavailable"))
strPages = Trim(Request.Form("pagesforsite"))
strMState = Trim(Request.Form("location"))
strProjecttype = Trim(Request.Form("projecttype"))
strMDescription = Trim(Request.Form("projectdescription"))


'this section sends the information to your email in an html format

Dim objMyMail1, msgBody, msgSubject
Set objMymail1 = Server.CreateObject("CDONTS.NewMail")

Dim strResponse
strResponse = "Regarding Tester"

msgSubject = strResponse

'this creates and prepares the html formatted email
msgBody ="<html>"
msgBody = msgBody & "<head>"
msgBody = msgBody & "<title>Site Response</title>"
msgBody = msgBody & "<style type='text/css'>"
msgBody = msgBody & "<!--"
msgBody = msgBody & "p { font-family: Arial, Helvetica, sans-serif; font-size: 75%; color: #333333;}"
msgBody = msgBody & "-->"
msgBody = msgBody & "</style>"
msgBody = msgBody & "</head>"
msgBody = msgBody & "<body>"
msgBody = msgBody & "<p>This is a request for ADS Graphics Firm Services</p>"


msgBody = msgBody & "<p>Name: "
msgBody = msgBody & strFrom
msgBody = msgBody & "</p>"


msgBody = msgBody & "<p>Email: "
msgBody = msgBody & strEmail
msgBody = msgBody & "</p>"


msgBody = msgBody & "<p>Phone: "
msgBody = msgBody & strPhone
msgBody = msgBody & "</p>"


msgBody = msgBody & "<p>Contact Time: "
msgBody = msgBody & strContact
msgBody = msgBody & "</p>"


msgBody = msgBody & "<p>Budget: "
msgBody = msgBody & strProjectbudget
msgBody = msgBody & "</p>"


msgBody = msgBody & "<p>Estimated # Pages:"
msgBody = msgBody & strPages
msgBody = msgBody & "</p>"

msgBody = msgBody & "<p>Current Location:"
msgBody = msgBody & strMState
msgBody = msgBody & "</p>"

msgBody = msgBody & "<p>Project Type:"
msgBody = msgBody & strProjecttype
msgBody = msgBody & "</p>"

msgBody = msgBody & "<p>Project Description:<br>"
msgBody = msgBody & strMDescription
msgBody = msgBody & "</p>"


msgBody = msgBody & "</body></html>"
'End of html format


objMyMail1.From = "tester@tester.com"
objMyMail1.To = "testerer@tester.com"

//'use the email address that you desire the message to be sent to..


objMyMail1.Subject = "Design Request"
objMyMail1.BodyFormat = 0
objMymail1.MailFormat = 0
objMyMail1.Body = msgBody
objMyMail1.Send
Set objMyMail1 = Nothing

%>

<!--
Everything above this poont will go above the head tag in your file
remember that this file should be named with an asp extension. -- contactresponse.asp
-->

<html>
<head>
<title>..:..Contact Page</title>
<style type="text/css">
<!--
p { font-family: Arial, Helvetica, sans-serif; font-size: 95%; color: #333333;}
-->
</style>
</head>
<body>

<!--
Put these paragraphs on the actual page inside your html code
Format them as needed
-->

<p>Thank you again for your interest <%= strFrom %></p>
<p>We will be in contact you shortly!</p>
<script language="Javascript">
alert ("Your email has been delivered successfully, Thank you.")
location = "Contact.htm"
</script>
</body></html>


******************************
It seems to work on some level.
It does create an email and even sends it in the correct format.
But the lables are the only items that are in the emal.
i.e. Name:
Phone:
Address:

all the fields are blank.

I used Trim(Request.Form("variable name")) to gather the text in the input fields, and double checked that the have the correct variable names. but they are still blank...

any ideas as to what the proble could be.
__________________
~Mr. Douks~
Mr.Douks is offline
Reply With Quote
View Public Profile
 
Old 05-23-2007, 12:02 PM Empty Form Fields
Mr.Douks's Avatar
Novice Talker

Posts: 9
Name: Andre
Location: ATL, Georgia. USA
I've been at this code for a while and still haven't reached the proper results.

PT1.
I have a form on an HTML page and the fields are properly named.
Method post is properly coded.

PT2.
I have an asp page that is suppose to acquire the data from the HTML form and send it to my email.
But whenever the form is sent the fields are blank. it's as if the form was sent without any text input in the fields.

Any clue on what im doing wrong?

strFrom = Trim(Request.Form("contactname"))
*****
is the code i use to request the data from the form on the html page.

Any help whould be GREAT.
__________________
~Mr. Douks~
Mr.Douks is offline
Reply With Quote
View Public Profile
 
Old 05-23-2007, 12:36 PM Re: Empty Form Fields
ExpressoDan's Avatar
Ultra Talker

Posts: 317
Name: This Space for Rent
Location: Georgia
YOUHOO another Georgian!

Check to see if the field is blank before processing the form

If Trim(Request.Form("contactname")) <> "" Then
'...process the email request
Else 'the field is blank
'...send an error message to the user
End If
__________________
Daniel
"I think therefore I am, I think." <!-- George Carlin
ExpressoDan is offline
Reply With Quote
View Public Profile Visit ExpressoDan's homepage!
 
Old 05-23-2007, 01:05 PM Re: Empty Form Fields
Mr.Douks's Avatar
Novice Talker

Posts: 9
Name: Andre
Location: ATL, Georgia. USA
That's the thing about it. I filled all the fields myself and sent them. (to test)
and they came through blank
__________________
~Mr. Douks~
Mr.Douks is offline
Reply With Quote
View Public Profile
 
Old 05-23-2007, 01:08 PM Re: Empty Form Fields
Mr.Douks's Avatar
Novice Talker

Posts: 9
Name: Andre
Location: ATL, Georgia. USA
I just tried sending a completely blank form, and it didnt go through. then i put dummy text in one of the field and it went through. just blank.
__________________
~Mr. Douks~
Mr.Douks is offline
Reply With Quote
View Public Profile
 
Old 05-23-2007, 10:18 PM Re: Requesting Data field info from the html page
ExpressoDan's Avatar
Ultra Talker

Posts: 317
Name: This Space for Rent
Location: Georgia
Looks like you have two threads about the same thing...

Post the code from the page that contains the actual email form. As Chris said above, it probably has something to do with the method in which you are submitting your form (post, get)
__________________
Daniel
"I think therefore I am, I think." <!-- George Carlin
ExpressoDan is offline
Reply With Quote
View Public Profile Visit ExpressoDan's homepage!
 
Old 05-24-2007, 01:27 AM Re: Requesting Data field info from the html page
Mr.Douks's Avatar
Novice Talker

Posts: 9
Name: Andre
Location: ATL, Georgia. USA
**The Code I have is this.

Code:
<form action="gdform.asp" method="post" enctype="multipart/form-data" name="adsemail">
     
        <table border=0 align="left">
          <td width="261">
          <tr>
            <td align="left">Contact Name:</td>
            <td width="421" align="left"><input name="contactname" type="text" value="" maxlength="30" /></td>
          </tr>
          <tr>
            <td align="left">Email Address: </td>
            <td align="left"><input name="emailaddress" type="text" maxlength="30" /></td>
          </tr>
          <tr>
            <td align="left">Phone Number:</td>
            <td align="left"><input name="phonenumber" type="text" maxlength="10"/></td>
          </tr>
          <tr>
            <td align="left" valign="top">Best time to contact you:</td>
            <td align="left"><input name="timecontact" id="contactmorning" type="radio" value="Morning">
              <label for="contactmorning">Morning</label>
              <br>
              <input name="timecontact" id="contactafternoon" type="radio" value="Afternoon">
              <label for="contactafternoon">Afternoon</label>
              <br>
              <input name="timecontact" id="contactevening" type="radio" value="Evening">
              <label for="contactevening">Evening</label></td>
          </tr>
          <tr>
            <td align="left">State/Providence: </td>
            <td align="left"><input name="location" type="text" id="state" value="" width="300"></td>
          </tr>
          
          <tr>
            <td align="left">Current Website (if Available)</td>
            <td align="left"><input name="currentsiteavailable" type="text"  value="http://www." size="20" maxlength="30" width="300"></td>
          </tr>
          <tr>
            <td>Estimated Number of Pages for Your Website:</td>
            <td align="left"><input name="pagesforsite" type="text"  value="" size="20" maxlength="25"></td>
          </tr><tr>
            <td align="left">Project Budget:</td>
            <td align="left"><select name="projectbudget" class="quoteform" id="budget" style="width:200px;">
                <option value="" selected>Please Select</option>
                <option value="1-149">-$149</option>
                <option value="150-300">$150-$300</option>
                <option value="301-600">$301-$600</option>
                <option value="601-1,000">$601-$1,000</option>
                <option value="1000plus">$1,000+</option>
              </select></td>
          </tr>
                    <tr>
            <td align="left">Project Type</td>
            <td align="left"><select name="projecttype" style="width:200px;">
                <option value="" selected>Please Select</option>
                <option value="1">Graphic Design</option>
                <option value="2">WebSite Design</option>
                <option value="3">Web Layout</option>
                <option value="4">Photo-Manipulation</option>
                <option value="5">3D Modeling</option>
                <option value="6">Business Cards</option>
                <option value="7">Banners</option>
                <option value="8">LightYear Alliance</option>
                <option value="9">Other</option>
              </select></td>
          </tr>
          <tr>
            <td align="left" valign="top">Project Description<br><img src="http://www.webmaster-talk.com/images/compasso.gif" alt="compas" width="200" height="150"></td>
            <td align="left" valign="top">
              <textarea name="projectdescription" cols="23" rows="10" id="projectdescription"></textarea>
</td>
          </tr>
          <tr><td align="right"><input name="submit" type="submit" value="Submit Your Request"></td><td align="left"><input name="reset" type="reset" value="Reset Form">
****
Thanks for the help.
I posted it in two threads because I wanted to improve my chances at getting help as soon as possible. I have a site that I really need to launch.
__________________
~Mr. Douks~

Last edited by chrishirst : 05-24-2007 at 11:22 AM. Reason: Added code tags
Mr.Douks is offline
Reply With Quote
View Public Profile
 
Old 05-24-2007, 10:25 AM Re: Requesting Data field info from the html page
Super Talker

Posts: 107
Not for nothing - I have to read the code better - but I would check with your sytems people or hosting service to see if they still support CDONTS.

I know mine doesn't and I had to change my programming for ASP Mailer.

Again, I have to read the code better... but I would start there.

DonnaZ
DonnaZ is offline
Reply With Quote
View Public Profile
 
Old 05-24-2007, 11:18 AM Re: Requesting Data field info from the html page
chrishirst's Avatar
Super Moderator

Posts: 12,752
Location: Blackpool. UK
Quote:
posted it in two threads because I wanted to improve my chances at getting help as soon as possible. I have a site that I really need to launch.
Having two threads on one problem does NOT help.

Merged them.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 05-24-2007, 11:27 AM Re: Requesting Data field info from the html page
chrishirst's Avatar
Super Moderator

Posts: 12,752
Location: Blackpool. UK
get rid of the enctype attribute, "multipart/form-data" should only be used when you are using "file" inputs.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 05-24-2007, 06:00 PM Re: Requesting Data field info from the html page
ExpressoDan's Avatar
Ultra Talker

Posts: 317
Name: This Space for Rent
Location: Georgia
Whats the name of the page that's doing the processing? If your using godaddy (which it looks like you are) and you want to process the email with your own script, don't post to gdform.asp. Instead, change it to the file that's doing the processing.

However, if you DO want to use godaddys form and the page you're posting to is gdform.asp, then you need to make sure you configure your email address in your hosting account control panel under form mailer (i think)
__________________
Daniel
"I think therefore I am, I think." <!-- George Carlin
ExpressoDan is offline
Reply With Quote
View Public Profile Visit ExpressoDan's homepage!
 
Old 05-24-2007, 06:37 PM Re: Requesting Data field info from the html page
Mr.Douks's Avatar
Novice Talker

Posts: 9
Name: Andre
Location: ATL, Georgia. USA
I was informed to change the enctype of the post to this.

<form action="gdform.asp" method="post" enctype="application/x-www-form-urlencoded" name="adsemail">

I did, but the results are still the same.

??It's looking pretty grim. But there's hope.
__________________
~Mr. Douks~
Mr.Douks is offline
Reply With Quote
View Public Profile
 
Old 05-26-2007, 04:04 PM Re: Requesting Data field info from the html page
Mr.Douks's Avatar
Novice Talker

Posts: 9
Name: Andre
Location: ATL, Georgia. USA
Thanks for the help. I found and modified a script to my site. works great.
Thanx again.

http://www.brainjar.com/asp/formmail/default.asp
__________________
~Mr. Douks~