:?:
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.

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:

<html>
<head>
<title> asp page</title>
</head>
<body>
<h1> Here is your contact information</h1>
<% 
'// declare variable names to hold the form field values
Dim strfullname, straddress, strcitystatezip, strphone
'// assign values to the declared variables
strfullname = Request.Form("fullname")
straddress = Request.Form("address")
strcitystatezip = Request.Form("citystatezip")
strphone = Request.Form("phone")
%>
<!-- Now display the results from the form submission using the above variables -->
Your Name : <%=strfullname%><br />
Your Address : <%=straddress%><br />
Your Address : <%=strcitystatezip%><br />
Your Phone : <%=strphone%><br />
</body>
</html>

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. :D

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.

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,

<%

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

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:

<%
Recipient = Request.Form("priority")

'// 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 build the form content into a single variable
dim strEmailBody
strEmailBody = "From: " & strname & VbCrLf
strEmailBody = strEmailBody & "Email: " & stremail  & VbCrLf
strEmailBody = strEmailBody & "Country: " & stremail & VbCrLf
'// etc, etc, you get the picture by  now

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 = stremail
JMail.Subject = strsubject

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

JMail.Body = strEmailBody

JMail.Priority = 3

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

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:

:confused: cya

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

No worries:D

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.