Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - How do I add new field to the form
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How do I add new field to the form

 Post Reply Post Reply Page  <123>
Author
ub3rl337ch3ch View Drop Down
Senior Member
Senior Member
Avatar

Joined: 16 February 2005
Location: Australia
Status: Offline
Points: 341
Post Options Post Options   Thanks (0) Thanks(0)   Quote ub3rl337ch3ch Quote  Post ReplyReply Direct Link To This Post Posted: 14 June 2005 at 11:43pm
vbcrlf is 'visual basic carriage return line feed' or something like that... its basically a spacer for simple formatting, and has the same effact as if you'd just pressed enter in word. (that's the general description, i can't remember the specifics)
 
to enter other things into the body you have to treat Mail.Body as a string which contains everything you want in the body. Imagine that it's what you're going to response.write into the email.
 
that said, heres an eg:
 
Mail.Body = request("body") & vbcrlf & "Checkbox: " & request.form("checkbox") & vbcrlf & "random text field: " & request.form("randomtext") & vbcrlf & "random select box: " & request.form("randomselect")
Back to Top
ub3rl337ch3ch View Drop Down
Senior Member
Senior Member
Avatar

Joined: 16 February 2005
Location: Australia
Status: Offline
Points: 341
Post Options Post Options   Thanks (0) Thanks(0)   Quote ub3rl337ch3ch Quote  Post ReplyReply Direct Link To This Post Posted: 14 June 2005 at 11:49pm
if your password is only in the asp, the only way that someone can get ahold of it is if they download the page itself form the web server, something that is usually pretty hard to do (and dependent entirely on your webhost's server)
 
asp sends *none* of the asp to the client side (unless of course it was response.write'n) So unless you're passwords are somehow in html tags or you have at some point coded "response.write password" into your page, then its pretty safe...
Back to Top
Lucent View Drop Down
Groupie
Groupie


Joined: 06 June 2003
Status: Offline
Points: 111
Post Options Post Options   Thanks (0) Thanks(0)   Quote Lucent Quote  Post ReplyReply Direct Link To This Post Posted: 14 June 2005 at 11:51pm

Thank you so much for your help!!!

If you don't mind here is another question..
 
is there anyway I can have the form also email me the URL of the page where the viewer sends the form from?
 
basically I'm placing this feedback form on another asp page where it always generates dynamic pages.. and when customers are giving me feedback on specific page.. I want to know which page they are talking about.   how would I do that?
Back to Top
ub3rl337ch3ch View Drop Down
Senior Member
Senior Member
Avatar

Joined: 16 February 2005
Location: Australia
Status: Offline
Points: 341
Post Options Post Options   Thanks (0) Thanks(0)   Quote ub3rl337ch3ch Quote  Post ReplyReply Direct Link To This Post Posted: 15 June 2005 at 12:05am
add a field to the form (which you put in the body as above) called something like posturl (or whatever) then at the head of the page put a js that calls it and sets it value like so:
 
<script language-"javascript">
document.formname.posturl.value = document.URL
</script>
 
you can also return the title with document.title
 
this just uses the js to find the url and paste it into the field.
there's probably a way that you can use asp to call the referring url, but i don't know it off the top of my head. I'll get back to you if i work it out... and i probably should since it'll come in useful at some point.
Back to Top
Lucent View Drop Down
Groupie
Groupie


Joined: 06 June 2003
Status: Offline
Points: 111
Post Options Post Options   Thanks (0) Thanks(0)   Quote Lucent Quote  Post ReplyReply Direct Link To This Post Posted: 15 June 2005 at 12:07am
Current_page_URL = "http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("URL") & "?" & Request.ServerVariables("QUERY_STRING")
 
My pages are dynamic.. I found the above script.. anyway I can incroporated into it?
Back to Top
ub3rl337ch3ch View Drop Down
Senior Member
Senior Member
Avatar

Joined: 16 February 2005
Location: Australia
Status: Offline
Points: 341
Post Options Post Options   Thanks (0) Thanks(0)   Quote ub3rl337ch3ch Quote  Post ReplyReply Direct Link To This Post Posted: 15 June 2005 at 12:16am

that'll allow you to avoid that bit of js (probably for the better since js slooooow) and just do a response.write in the value of the posturl field like so:

 
<input type="hidden" name="posturl" value="<%response.write request.servervariables("URL")%>">
 
that'll spit out the path of the file, so for example on this page it'd be wwf_forum/forum_posts.asp
 
If you want to have it as a full URL then just response.write the entire string og Current_page_URL and that'll spit out something in the vein of  http://forums.webwiz.net/forum_posts.asp?TID=15456&TPN=2


Edited by ub3rl337ch3ch - 15 June 2005 at 12:16am
Back to Top
Lucent View Drop Down
Groupie
Groupie


Joined: 06 June 2003
Status: Offline
Points: 111
Post Options Post Options   Thanks (0) Thanks(0)   Quote Lucent Quote  Post ReplyReply Direct Link To This Post Posted: 15 June 2005 at 11:22am
I tried it.. but it doesn't email the result of URL.

simpl.asp
===========================
<%
' change to address of your own SMTP server
strHost = "smtp.mydomain.com"
If Request("Send") <> "" Then
   Set Mail = Server.CreateObject("Persits.MailSender")
   ' enter valid SMTP host
   Mail.Host = strHost
   Mail.Username = "rt@mydomain.com"
   Mail.Password = "123456"
   Mail.From = "rt@mydomain.com"
   Mail.FromName = "PN Report Center"
   Mail.AddAddress (rt@mydomain.com)
   Mail.Subject = Request("Subject")
   Mail.Body = request("Body") & vbcrlf & vbcrlf & "Checkbox: " & request.form("checkbox") & vbcrlf & vbcrlf & "URL: " & request.form("posturl")
   strErr = ""
   bSuccess = False
   On Error Resume Next ' catch errors
   Mail.Send ' send message
   If Err <> 0 Then ' error occurred
      strErr = Err.Description
   else
      bSuccess = True
   End If
End If
%>
<% If strErr <> "" Then %>
<h3>Error occurred: <% = strErr %>
<% End If %>
<% If bSuccess Then %>
Success! Message sent to <% = Request("To") %>.
<% End If %>
==============================
 
simple.htm
==============================
<HTML>
<BODY BGCOLOR="#FFFFFF">
<FORM METHOD="POST" ACTION="Simple.asp">
<TABLE CELLSPACING=0 CELLPADDING=2 BGCOLOR="#E0E0E0">
<strong><font color="red" size="+1"> <%= Request.ServerVariables("HTTP_REFERER") %></font></strong>
<TR>
   <TD>Body:</TD>
   <TD><TEXTAREA NAME="Body"></TEXTAREA></TD>
</TR>
<TR>
  <TD COLSPAN=2><input type="text" name="subject"></TD>
</TR>
<TR>
  <TD COLSPAN=2><input type="checkbox" name="checkbox" value="Misspell">
    <input type="checkbox" name="checkbox" value="Miss">
    <input type="checkbox" name="checkbox" value="incorrect">
    <input type="checkbox" name="checkbox"'value="link">
<input type="hidden" name="posturl" value='<%response.write request.servervariables("URL")%>'>
</TD>
</TR>
<TR>
   <TD COLSPAN=2><INPUT TYPE="SUBMIT" NAME="Send" VALUE="Send Message">
</TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>
=================================
Back to Top
Lucent View Drop Down
Groupie
Groupie


Joined: 06 June 2003
Status: Offline
Points: 111
Post Options Post Options   Thanks (0) Thanks(0)   Quote Lucent Quote  Post ReplyReply Direct Link To This Post Posted: 16 June 2005 at 11:27pm
I made a terrible mistake.. my page was htm not asp.. no wonder it doesnt recognize <%response.write request.servervariables("URL")%>
that is why is doesn't work...Tongue
Back to Top
 Post Reply Post Reply Page  <123>

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.