Help Me with ASP Forms Please

Results 1 to 7 of 7

Thread: Help Me with ASP Forms Please

  1. #1
    blueghost@hotmail.com Guest

    Default Help Me with ASP Forms Please

    Hi fellows,<BR><BR>Please help me out......<BR><BR>I have been assigned to build a webbased project status form in our company&#039s existing intranet. ( platform: Windows NT Server, with IIS 4.0, Access 97 database loaded on it )<BR><BR>Org. Structure:<BR><BR>There are ten managers, and they report to one General Manager.<BR><BR>Requirement:<BR>Want a webbased form where each manager login/password to a default page, sample code:<BR><BR>&#060;FORM ACTION="form.asp" METHOD="post"&#062;<BR>Login:&#060;INPUT TYPE="text" NAME="LoginId" SIZE="15"&#062;&#060;/INPUT&#062;<BR>Password:&#060;INPUT TYPE="password" NAME="password" IZE="15"&#062;&#060;/INPUT&#062;<BR>&#060;INPUT TYPE="submit" VALUE="Login"&#062;&#060;/INPUT&#062;<BR>&#060;INPUT TYPE="reset" VALUE="Reset"&#062;&#060;/INPUT&#062;<BR><BR>I have also created an access database, Login_Info.mdb,<BR>with the following Table ( empLogin ), Fields:<BR>LoginId<BR>password<BR>manager_email<BR >gen_manager_email<BR><BR><BR><BR>When a manager logins thru the defaul page, it will taken to the<BR>form.asp page, which will look like ( the part before the &#060;html&#062; will help validate the login and password and please correct me, wherever, I am wrong....):<BR><BR>&#060;%@ LANGUAGE="VBSCRIPT"<BR> EnableSessionState= False%&#062;<BR><BR>&#060;% Set OBJdbConnection = Server.CreateObject("ADODB.Connection")<BR>OBJdbCo nnection.Open "Login_Info.mdb"<BR> <BR> uname = Request.Form("uname")<BR> password = Request.Form("password")<BR><BR>SQLQuery = "select * from emplogin where LoginId = &#039" + uname + "&#039 and password = &#039" + password + "&#039"<BR>Set ADOrs = OBJdbConnection.Execute(SQLQuery)<BR>if ADOrs.EOF and ADOrs.BOF then<BR> response.write &#060;h2&#062;Invalid Password! Please Try Again&#060;/h2&#062;<BR> elseif<BR> response.redirect "href="default.htm"<BR> end if<BR>%&#062;<BR>&#060;html&#062;<BR>&#060;head&#0 62;<BR>&#060;title&#062;<BR>Form.asp<BR>&#060;/title&#062;<BR>&#060;body&#062;<BR>&#060;form method="POST" action="" onSubmit=""&#062;<BR>Project Name: &#060;input type="text" name="Project_Name" size="60"&#062;<BR>Project Start: &#060;input type="text" name="Start_Date" size="18"&#062;<BR>Project End: &#060;input type="text" name="End_Date" size="18"&#062;<BR>Project Manager: &#060;input type="text" name="PM_Name" size="34"&#062;<BR>Status: &#060;textarea rows="6" name="Status" cols="52"&#062;&#060;/textarea&#062;<BR><BR>&#060;input type="submit" value="Submit" name="Submit"&#062;&#060;/p&#062;<BR>&#060;input type="reset" value="Reset" name="Reset"&#062; <BR>&#060;/form&#062;<BR>&#060;/body&#062;<BR>&#060;/html&#062;<BR><BR><BR><BR>Desired Result:<BR>When a particular manager submits a form, it should <BR>send the form thru an email to General_Manager@xyz.com, and cc: to himself ( meaning the manager who is submitting that form, so one copy will be emailed to the general manager and the cc will be emailed back to the person, who initially submitted the form).<BR><BR>Please help me out by filling up the proper code in the submit input section...so that when a manager logins to the website, the form.asp will check up the login_Info.mdb ( database ) and based upon that puts the GM email and the person who logged in ( for cc: )in the submit section.<BR><BR>Please correct me with the code cuz it is not working......help :(<BR><BR>Thanks.<BR><BR>Casper.<BR>

  2. #2
    SamJ Guest

    Default RE: Help Me with ASP Forms Please

    I think you are asking for too much. No one is going to write your whole program for you. I think you need to figure out some specific questions you want to ask.<BR><BR>But I few things I noticed. You need to use a component like CDOMail or ASPMail in order to send mail.<BR><BR>You have a line Response.redirect "href="default.htm" This isn&#039t going to work. All you need is esponse.redirect "default.htm"

  3. #3
    Keith Fowler Guest

    Default RE: Help Me with ASP Forms Please

    I must agree, you are asking for someone to do your job for you. This messageboard is for those looking for some help in order to help themselves. Try looking through the articles contained on 4guysfromrolla.com, learnasp.com, and the many other ASP sites.<BR><BR>The CDONT (Collaboration Data Objects for NT Server) component comes installed with IIS4. Look for some tutorials on how to use it.<BR><BR>Good Luck! Come back if you need HELP!

  4. #4
    Join Date
    Dec 1969
    Posts
    118

    Default RE: Help Me with ASP Forms Please

    I can see a couple of problems other than those already mentioned.<BR> In the code:<BR>if ADOrs.EOF and ADOrs.BOF then<BR>response.write &#060;h2&#062;Invalid Password! Please Try Again&#060;/h2&#062;<BR>elseif<BR>response.redirect "href="default.htm"<BR>end if<BR> 1-The elseif makes no sense. elseif what?. It should be else.<BR> 2-Having said that, it appears that your coding would then cause you to do almost the opposite of what you want. I would do the following:<BR>if ADOrs.EOF and ADOrs.BOF then%&#062;<BR> &#060;SCRIPT language="JavaScript"&#062;<BR> alert("Invalid Password! - Please Try Again");<BR> history.back();<BR> &#060;/SCRIPT&#062;<BR>&#060;%end if<BR> In place of the code above. This returns to the login page if the login was bad, and falls thru if it was good.<BR><BR> 2-Your FORM statement needs an action="something.asp"<BR>where something.asp is the script that will send the email using the data passed to it from the FORM. As the others stated, I am not going to do the coding for this, but I would suggest searching this site for CDO. You should get more than enough information to write that script.<BR><BR>


  5. #5
    Join Date
    Dec 1969
    Posts
    118

    Default RE: Help Me with ASP Forms Please

    What the heck. I might as well get you started on emailing with CDO.<BR> First you should have SMTP installed on your Web Server(see Option Pack 4) and running.<BR> Now for what the code should look like. Suppose you have passed a peice of data(DATA) and an emaill address(EMAILADDR) from a Form(Method=POST).<BR> 1-Get the passed stuff with:<BR> &#060;%datawa = Request.Form("DATA")<BR> emailwa = Request.Form("EMAILADDR")<BR> %&#062;<BR> 2-Construct and send the email:<BR> DIM objCDO<BR> Set objCDO = Server.CreateObject("CDONTS.NewNail")<BR> objCDO.To = emailwa<BR> objCDO.Subject = "whatever you want"<BR> DIM txtSubject<BR> txtSubject = "Here is the passed data:" & Chr(10) & Chr(10)<BR> txtSubject = txtSubject & datawa<BR> objCDO.Body = txtSubject<BR> objCDO.Send<BR> Set objCDO=Nothing<BR> %&#062;<BR><BR> This will send a line that says "Here is the passed data:"<BR> Slip down a line and display the data.<BR><BR> Chr(10) is newline. <BR> CDO has other properties such as .From, but I will leave it to you to learn more.<BR>

  6. #6
    sateesh Guest

    Default RE: Help Me with ASP Forms Please

    &nbsp;<BR> Hai! Here I am suggesting a method which may solve your problem :<BR><BR> In the second page that is form.asp, first U do the validation part before the &#060;HTML&#062; tag and in the form tag U may use this :<BR><BR> &#060;FORM ACTION="MAILTO:name@domain.com&#062;<BR> &#060;!--<BR> here U write the info regarding the PROJECT i.e,<BR> project name,project start,end,manager,status etc..<BR><BR> --&#062;<BR>By this U can send the form info.. to that particular Internet<BR> Address .<BR> How to send a copy back to the same person I don&#039t know( as <BR> I am also a novice)<BR> Hope this info will help U .<BR> If U find a better method than this please mail to me.<BR> My mail ID is kls_kumar@yahoo.com<BR> BYE----<BR><BR>

  7. #7
    sateesh Guest

    Default RE: Help Me with ASP Forms Please

    &nbsp;<BR> Hai! Here I am suggesting a method which may solve your problem :<BR><BR> In the second page that is form.asp, first U do the validation part before the &#060;HTML&#062; tag and in the form tag U may use this :<BR><BR> &#060;FORM ACTION="MAILTO:name@domain.com&#062;<BR> &#060;!--<BR> here U write the info regarding the PROJECT i.e,<BR> project name,project start,end,manager,status etc..<BR><BR> --&#062;<BR>By this U can send the form info.. to that particular Internet<BR> Address .<BR> How to send a copy back to the same person I don&#039t know( as <BR> I am also a novice)<BR> Hope this info will help U .<BR> If U find a better method than this please mail to me.<BR> My mail ID is kls_kumar@yahoo.com<BR> BYE----<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •