943,492 Members | Top Members by Rank

Ad:
  • ASP Discussion Thread
  • Unsolved
  • Views: 6904
  • ASP RSS
Sep 16th, 2004
0

Help with asp form will not display contact information

Expand Post »

I am new to this site but, I need help figuring out this simple form that is suppose to send the data to our school's server. The first one is my html form and the second is the asp file. I don't know how to get the simple form in my html file to display whatever is put in the text boxes. Thanks for any help.
I used response.write for the first asp page i did. But this is different with a form. Our book is beginning asp 3.0 by wrox publisher.
ok this is my html file
<html>
<head>
<title>asp form</title>
</head>
<body>
<center><h1><font color="3444FF">Please enter your contact information below</h1></center></font><br>

<form action="3b-formdata.asp" method=post>
<center><table border="5" bgcolor="99CCFF"></center>
<tr>
<td align="left"<p> Please enter your full name:</p>
<input type="text" name="fullname" size="25" maxlength = "50"></td>
</tr>
<br>

<tr>
<td align="left" <p> Please enter address:</p>
<input type="text" name="address" size="25" maxlength = "50"></td>
</tr>
<br>
<td align="left" <p> Please enter your city,state and zip.</p><input type="text" name="citystatezip" size="25" maxlength="75"></td><br>
</tr>
<tr>
<td align-"left" <p> Please enter your phone number with area code.</p> <input type="text" name="phone" size="25" maxlength="15"></td></tr>
<br>
<tr>
<td align="center"
<p><input type="submit" value="Submit contact information here"><br>

</table>
</form>
</body>
This is the asp file to go with that.
<html>
<head>
<title> asp page</title>
</head>
<body>
<h1> Here is your contact information</h1>
<%
Dim strfullname
strfullname = Request.Form("fullname")

%><br />

<%
Dim straddress
straddress = Request.Form("address")
%><br />

<%
Dim strcitystatezip
strcitystatezip = Request.Form("citystatezip")
%><br />
<%
Dim strphone
strphone = Request.Form("phone")
%><br />


</body>
</html>
I AM NOT SURE HOW TO MAKE THIS SIMPLE FORM DISPLAY IN THE BROWSER WHEN I SEND IT TO THE SERVER. I ONLY SEE THE HEADING AND NOTHING ELSE.
PLEASE HELP ME.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
jchamel is offline Offline
7 posts
since Sep 2004
Sep 19th, 2004
0

Re: Help with asp form will not display contact information

OK everything is good with your code. The reason you are not seeing any output from the form submission on your asp page is because you are not using any code to display the information.

Try using this code sample for your asp page:
ASP Syntax (Toggle Plain Text)
  1. <html>
  2. <head>
  3. <title> asp page</title>
  4. </head>
  5. <body>
  6. <h1> Here is your contact information</h1>
  7. <%
  8. '// declare variable names to hold the form field values
  9. Dim strfullname, straddress, strcitystatezip, strphone
  10. '// assign values to the declared variables
  11. strfullname = Request.Form("fullname")
  12. straddress = Request.Form("address")
  13. strcitystatezip = Request.Form("citystatezip")
  14. strphone = Request.Form("phone")
  15. %>
  16. <!-- Now display the results from the form submission using the above variables -->
  17. Your Name : <%=strfullname%><br />
  18. Your Address : <%=straddress%><br />
  19. Your Address : <%=strcitystatezip%><br />
  20. Your Phone : <%=strphone%><br />
  21. </body>
  22. </html>
Reputation Points: 16
Solved Threads: 7
Junior Poster
Lafinboy is offline Offline
166 posts
since Jul 2004
Sep 27th, 2004
0

Re: Help with asp form will not display contact information

Thanks so much. I looked at that code so much, I never noticed that I didn't tell it what to display. My teacher told me another way to do this was response.write ("full name") etc, under the request.form. I was requesting but not telling it what to do huh. This is only my second asp file. Thanks so much. What book did you learn from? We are using Begining active server pages by several authors and the company wrox.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
jchamel is offline Offline
7 posts
since Sep 2004
Sep 27th, 2004
0

Re: Help with asp form will not display contact information

Happy to help.

<%=variablename%> is a shorthand way of writing <%Response.Write variablename%>

I started with the same book, then hit the forums and searched google to fill in the gaps and expand my knowledge. Another book I always keep nearby is VBScript in a Nutshell published by O'Reilly. It's a quick reference to the language and it's use, like a dictionary. Really useful when you need to check the use/syntax of a function.

Good luck with your learning. And keep asking questions - it's the best way to learn.
Reputation Points: 16
Solved Threads: 7
Junior Poster
Lafinboy is offline Offline
166 posts
since Jul 2004
Aug 4th, 2005
0

Re: Help with JMAIL asp form will not display contact information

Hi all.. This is my first time to this forum and i must say very impressive work here, But i need some serious help with a problem i have with the topic overhead here.

I have used the code along side more code. find the code below,

Quote ...
<%

Name = Request.Form("name")
SenderEmail = Request.Form("email")
Subject = "Regarding " & Request.Form("subject")
Recipient = Request.Form("priority")
Body = Request.Form("body")

Set JMail = Server.CreateObject("JMail.SMTPMail")

' Below you should enter your own SMTP-server
JMail.ServerAddress = "I Have it set, But i am not displaying, Sure you will understand"

JMail.Sender = Senderemail
JMail.Subject = Subject

JMail.AddRecipient "I Have it set, But i am not displaying, Sure you will understand"

JMail.Body = Body

JMail.Priority = 3

JMail.AddHeader "Originating-IP", Request.ServerVariables("REMOTE_ADDR")
JMail.Logging = True
JMail.Execute

'// declare variable names to hold the form field values
Dim strname, stremail, strcountry, strbody, strsubject, strabout, strto, strhomepage, strpriority
'// assign values to the declared variables
strname = Request.Form("name")
stremail = Request.Form("email")
strcountry = Request.Form("country")
strbody = Request.Form("body")
strsubject = Request.Form("subject")
strabout = Request.Form("about")
strto = Request.Form("to")
strhomepage = Request.Form("website")
strpriority = Request.Form("priority")

%>
<!-- Now display the results from the form submission using the above variables -->
<p align="left">
<span class="style5">Message To : <%=strto%><br />
Subject : <%=strsubject%><br />
Full Name : <%=strname%><br />
Email Address : <%=stremail%><br />
Country : <%=strcountry%><br />
Homepage : <%=strhomepage%><br />
Where did you hear about us : <%=strabout%><br />
Message Priority : <%=strpriority%><br />
Mail Message : <%=strbody%></span></span></p>
Now, The information is been displayed when you submit the form,

Preview here : www.DIRTYRATSCLAN.com/contact.htm

It is also sending the email to my account with no flaw, The problem i am having is that the email is not stating all fields of the form. It is just giving the Email address and subject, I need all the area's for instance, Website & Priority..

I would appreciate immediate help with this issue as i have been up 17 hours

This is my first time working with .asp coding so please take that into account..

Kind Regards,
Sinister747
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sinister747 is offline Offline
14 posts
since Aug 2005
Aug 4th, 2005
0

Re: Help with asp form will not display contact information

The reason you are only getting the value of the form field <body> is because that is the only field you are including in your email. I would modify your code a bit so the form field data is collected before you process the email, and you can then merge the form fields into a layout that is suitable for you, something along the lines of:
ASP Syntax (Toggle Plain Text)
  1. <%
  2. Recipient = Request.Form("priority")
  3.  
  4. '// declare variable names to hold the form field values
  5. Dim strname, stremail, strcountry, strbody, strsubject, strabout, strto, strhomepage, strpriority
  6. '// assign values to the declared variables
  7. strname = Request.Form("name")
  8. stremail = Request.Form("email")
  9. strcountry = Request.Form("country")
  10. strbody = Request.Form("body")
  11. strsubject = Request.Form("subject")
  12. strabout = Request.Form("about")
  13. strto = Request.Form("to")
  14. strhomepage = Request.Form("website")
  15. strpriority = Request.Form("priority")
  16.  
  17. '// now build the form content into a single variable
  18. dim strEmailBody
  19. strEmailBody = "From: " & strname & VbCrLf
  20. strEmailBody = strEmailBody & "Email: " & stremail & VbCrLf
  21. strEmailBody = strEmailBody & "Country: " & stremail & VbCrLf
  22. '// etc, etc, you get the picture by now
  23.  
  24. Set JMail = Server.CreateObject("JMail.SMTPMail")
  25.  
  26. ' Below you should enter your own SMTP-server
  27. JMail.ServerAddress = "I Have it set, But i am not displaying, Sure you will understand"
  28.  
  29. JMail.Sender = stremail
  30. JMail.Subject = strsubject
  31.  
  32. JMail.AddRecipient "I Have it set, But i am not displaying, Sure you will understand"
  33.  
  34. JMail.Body = strEmailBody
  35.  
  36. JMail.Priority = 3
  37.  
  38. JMail.AddHeader "Originating-IP", Request.ServerVariables("REMOTE_ADDR")
  39. JMail.Logging = True
  40. JMail.Execute
  41. %>
Reputation Points: 16
Solved Threads: 7
Junior Poster
Lafinboy is offline Offline
166 posts
since Jul 2004
Aug 4th, 2005
0

Re: Help with asp form will not display contact information

Greatly appreciated and nice fast reply, Thank you very much. If i have any problems i will post back, However it seems very simple :rolleyes:

cya
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sinister747 is offline Offline
14 posts
since Aug 2005
Aug 4th, 2005
0

Re: Help with asp form will not display contact information

Well i will be damned.. Would you look at that. You's guys are ACE !.. keep up the good work and thank you SO SO SO Much !

On Part of DIRTY RATS CLAN and myself personelly thank you's
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sinister747 is offline Offline
14 posts
since Aug 2005
Aug 4th, 2005
0

Re: Help with asp form will not display contact information

No worries
Reputation Points: 16
Solved Threads: 7
Junior Poster
Lafinboy is offline Offline
166 posts
since Jul 2004
Dec 29th, 2005
0

Re: Help with asp form will not display contact information

Hi All,

First of all the script i have posted above is now working fine, However i want to make it a little more advanced!.

I now have setup a system for sending Receipts to members of our Gaming Community.

What happens is this.

1st Page.

On the first page it takes information from a Database and places it into Text Boxs on a Form.

I then edit the information in the text boxs and hit Submit to send the email.

So the FORM submits to my page that sends the mail like the script above, But for some reason it WONT send the mail.

If i make it send a Textbox called " body " then it works fine, but i can't get it to send the information in HTML format.

All help will be appreciated as you's dealt with my problem very professionally last time i feel there is no other place to go.

Code Below;

<%
Name = Request.Form("name")
SenderEmail = Request.Form("email")
Subject = "DIRTY RATS CLAN - Payment Received"

'// declare variable names to hold the form field values
Dim strusername, strname, strdate, stramount, strpaypalfee, stramountreceived, strcovertill, stramountdue, strduedate, strcovermonth, strnotes, strID

' Get the form data
strID = Request.Form("id")
strusername = Request.Form("username")
strname = Request.Form("name")
strdate = Request.Form("date")
stramount = Request.Form("amount")
strpaypalfee = Request.Form("paypalfee")
stramountreceived = Request.Form("amountreceived")
strcovertill = Request.Form("covertill")
stramountdue = Request.Form("amountdue")
strduedate = Request.Form("duedate")
strcovermonth = Request.Form("covermonth")
strnotes = Request.Form("notes")
senderEmail = Request.Form("email")
subject = "DIRTY RATS CLAN - Payment Notification For" & Request.Form("username")
recipient = Request.Form("recipient")
strReferer = request.servervariables("HTTP_REFERER")
strServer = Replace(request.servervariables("SERVER_NAME"),"www.","")
strSMTPServer = "smtp." & strServer

' check referer
intComp = inStr(strReferer, strServer)
If intComp > 0 Then
blnSpam = False
Else
' Spam Attempt Block
blnSpam = True
End If

' Create the JMail message Object
set msg = Server.CreateOBject( "JMail.Message" )

' Set logging to true to ease any potential debugging
' And set silent to true in case you wish to handle the errors yourself
msg.Logging = true
msg.silent = true

' Enter the sender data
msg.From = senderEmail

' Note that as addRecipient is a method and not
' a property, you do not use an equals ( = ) sign
msg.AddRecipient recipient

' The subject of the message
msg.Subject = subject

' And the body
msg.body = "<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN"">" & vbCrLf _
& "<html>" & vbCrLf _
& "<head>" & vbCrLf _
& " <title>Sample Message From ASP 101</title>" & vbCrLf _
& " <meta http-equiv=Content-Type content=""text/html; charset=iso-8859-1"">" & vbCrLf _
& "</head>" & vbCrLf _
& "<body bgcolor=""#383838"">" & vbCrLf _
& " Dear " & strusername & vbCrLf _
& "You are receiving this receipt due to a recent update to your Monthly Subscription Fee." & vbCrLf _
& "Please find your receipt below;" & vbCrLf _
& " -----------------------------------------------------------------------------------" & vbCrLf _
& " Our Referance No : " & strID & vbCrLf _
& " Name: " & strname & vbCrLf _
& " Username: " & strusername & vbCrLf _
& " Item Title: Dirty Rats Clan - Monthly Subscription Fee " & vbCrLf _
& " ----------------------------------------------------------------------------------- " & vbCrLf _
& " Invoice Payment Date: " & vbCrLf _
& " Payment Cover Till: " & vbCrLf _
& " ----------------------------------------------------------------------------------- " & vbCrLf _
& " >> Amount Sent: " & stramount & vbCrLf _
& " >> Transfer Fee: " & strpaypalfee & vbCrLf _
& " >> Total Received: " & stramountreceived & vbCrLf _
& " ----------------------------------------------------------------------------------- " & vbCrLf _
& " <p> " & vbCrLf _
& " This message (including any attachments) is confidential and may be " & vbCrLf _
& " legally privileged. If you are not the intended recipient, you should " & vbCrLf _
& " not disclose, copy or use any part of it - please delete all copies " & vbCrLf _
& " immediately and notify DIRTY RATS CLAN on FalseEmail@Dirtyratsclan.com " & vbCrLf _
& " </p> " & vbCrLf _
& " <p> " & vbCrLf _
& " Any information, statements or opinions contained in this message " & vbCrLf _
& " (including any attachments) are given by the author. They are not " & vbCrLf _
& " given on behalf of DIRTY RATS CLAN unless subsequently confirmed by an individual " & vbCrLf _
& " other than the author who is duly authorised to represent DIRTY RATS CLAN. " & vbCrLf _
& " </p> " & vbCrLf _
& " DIRTY RATS CLAN is registered in the Republic of Ireland & United Kingdom." & vbCrLf _
& "</body>" & vbCrLf _
& "</html>" & vbCrLf

' Now send the message, using the indicated mailserver
If NOT blnSpam Then

if not msg.Send(strSMTPServer ) then
Response.write "<pre>" & msg.log & "</pre>"
else
Response.write "Message Sent Sucessfully!"
end if

end if

%>
<body>
<p class="style2"><a href="WITHHELD" target="_self"><strong>Return to Admin Menu </strong></a></p>
</body>
</html>
<%
' Clear the object
set msg = nothing
%>


Thank you in advance.

Regards,
Sinister747
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sinister747 is offline Offline
14 posts
since Aug 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP Forum Timeline: cdo using combo box in my form
Next Thread in ASP Forum Timeline: login with cookie





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC