Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

New to asp and need advice/Help

Status
Not open for further replies.

jgo333n

Programmer
Jul 16, 2007
27
GB
Hi,
I am a windows developer and have had this droped into my lap at last minute. I have very little understanding of ASP and have been tasked with this problem

I have been asked to receive a post back which will contain a mobile phone number and an email address i need to capture these two fields and then formulate an email and send it. I know this is a bit vague but can anyone help me with this perhaps a worked or working example?
I presume i will need to write sone vb script to create the email object apopulate its properties and execute the send method, this i know how to to in vb6/vb.net and SQL SErver but not in a web environment.

Many thanks

Daren
 
You can get the posted HTML form data using the Request object. This object exposes a collection of name/value pairs derived from the HTTP Request.

Unless you are using some 3rd party software, this link will help with sending the email:
 
This is just what i need many thanks it is a great help, one thing how do i get the moblile number/ email address from the request object into a variable in order to pass into the script you knidly pointed me to?
 
see w3Schools for capturing form data using the Request object as Sheco suggested....

strEmail = Request.Form("EMail")
strPhone = Request.Form("Phone")

where EMail and Phone are the 'name's of the inputs on a form that is POSTED.

HTH

Mych
 
From this statement you will understand how very New i am to this stuff, it is a mystery at the moment.

Can one of you clever chaps out there tell me how to execute a script on postback but only on post back?
Even better a worked example ot a link to one would be of great help,
other wise, if i can find them, I am going to Hire the 'A' team.
 
If you give the form's submit button a NAME then it will be submitted along with the from. Consider this snippet of HTML:
Code:
<form method="post" action="MyPage.asp">
  Phone: 
  <input type="text" name="Phone">
  <br>

  Email:
  <input type="text" name="Email">
  <br>

  <input type="submit" value="Send" [b]name="SubmitButton"[/b]>
</form>

Notice how the submit button has a name?

Now suppose I fill in the form and click submit... my browser will send an HTTP Request to the web server that includes, among other things, the following name/value pairs:[tt]
Phone=555-1212
Email=mymail@mydomain.tld
SubmitButton=Send[/tt]


So if you want to test whether an ASP is being loaded because it was submitted via this form, you could use some variation of this:
Code:
<%
If Request.Form("SubmitButton") = "Send" Then
  Response.Write "Form was submitted"
Else
  Response.Write "Form was NOT submitted"
End If
%>
 
That is of great help, my problem seems to be where to put the vbscript that is checking for a postback in the html so that it is triggered when the page is loaded/posted back. I appricate i am being dim but whilst an accomplished windows dev this todate is my total experience of asp!.
 
I have attached the html :
<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>SMS and Email Page</title>
<script language="VBscript">
Sub SendSMS()
if Request.form("SubmitButton") = "Send" then
response.write "Form submitted"
else
response.write "Form Not Submitted"
end if
End Sub
</script>
</head>

<body onload=SendSMS()>

<form id="WebForm1" method="post">
<table cellspacing="0" cellpadding="1" border="1" width="100%">
<tr>
<td colspan="2" align="center" valign="center">
<h1>SMS and Email Page.</h1>
</td>
</tr>
<tr>
<td align="center"><input type="text" name="mobile" size="20"></td>
<td width="50%" align="center">
<input type="submit" name="SubmitButon" value="Send"></td>
</tr>
</table>
</form>

</body>

</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top