1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

PHP and/or ASP

Discussion in 'Software Development' started by DJ [email protected], Dec 8, 2001.

Thread Status:
Not open for further replies.
Advertisement
  1. DJ P@CkMaN

    DJ [email protected] Thread Starter

    Joined:
    Aug 8, 2001
    Messages:
    413
    hey, i have a site and i want to make a form that has about 8 text fields and a submit button and when the button is pressed, it emails all the information entered to a certain address. is this possible without any add-ons installed on the server end??
    please help
     
  2. Rockn

    Rockn

    Joined:
    Jul 29, 2001
    Messages:
    21,334
    For ASP you can use their CDONTs already a part of ASP. It is a little limited but it works. Not sure about PHP tho. There are components like ASPmail you can buy for a minimal fee also.
     
  3. Talismanic

    Talismanic

    Joined:
    May 25, 2000
    Messages:
    409
    DJ [email protected] , did you get this figured out. If not let me know and I will post an ASP solution for you.
     
  4. DJ P@CkMaN

    DJ [email protected] Thread Starter

    Joined:
    Aug 8, 2001
    Messages:
    413
  5. Rockn

    Rockn

    Joined:
    Jul 29, 2001
    Messages:
    21,334
    THe only problem with ASp is finding a server that supports it. Almost all servers support CGI and it's not that hard to use. Didn't realize we were doing it for you tho.
     
  6. DJ P@CkMaN

    DJ [email protected] Thread Starter

    Joined:
    Aug 8, 2001
    Messages:
    413
    well if there was someway i could learn it i would do it my self, but i think i got it under control, i have a pc world mag that tell me how to do something similar with PHP
     
  7. Rockn

    Rockn

    Joined:
    Jul 29, 2001
    Messages:
    21,334
    Does the server support PHP?
     
  8. Talismanic

    Talismanic

    Joined:
    May 25, 2000
    Messages:
    409
    This is a pretty simplistic demo but I think you will get the idea. Basically you have two text boxes one to act as the text to send and the other to fill in the email address.

    Once submitted the information will be sent to the email address you entered. One thing to remember you will need a host that supports ASP, most Windows servers do. And you will need some sort of mail component. I used Jmail (free for personal use) but you can use any including CDONTS. You will just need to modify the script slightly to work with your component.

    Edit - Since the HTML is turned on here at TSG the code was being displayed as regular HTML. You can see the code here:

    Sending form contents in email (CDONTS) <--- edited to replace dead link.
     
  9. DJ P@CkMaN

    DJ [email protected] Thread Starter

    Joined:
    Aug 8, 2001
    Messages:
    413
  10. Mithrilhall

    Mithrilhall

    Joined:
    Mar 28, 2001
    Messages:
    781
    Simple asp code:


    This gets values from a previous page but you can submit to the page that processes the script. I just started working with php at home and have no clue how to do this in that yet, sorry.

    (Please dismiss the .. before everything, I don't know how to get the code to appear otherwise)

    Code:
    <..%@ Language=VBScript %..>
    <..%Option Explicit%..>
    <..%Response.Buffer = True%..>
    <..HTML..>
    <..HEAD..>
    <..Title><../Title..>
    <..META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0"..>
    <../HEAD..>
    <..BODY..>
    <..%
    	'Delcare variables here
    	Dim MailObject
    	Dim strFrom
    	Dim strTo
    	Dim strSubject
    	Dim strMessage
    		
    	'Use these four lines if using method=post
    	strFrom    = Request.Form("mailFrom")
    	strTo      = Request.Form("mailTo")
    	strSubject = Request.Form("mailSubject")
    	strMessage = Request.Form("mailMessage")
    	
    	Set MailObject = Server.CreateObject("CDONTS.NewMail")
    
    	MailObject.Importance=2
    	MailObject.From=strFrom
    	MailObject.To=strTo
    	MailObject.Bcc="[email protected]"
    	MailObject.Subject=strSubject
    	MailObject.Body=strMessage
    
    	MailObject.Send
    			
    	Set MailObject = nothing
    %..>
    <..Table align=center border=2 width=75% cellpadding=2 cellspacing=2..>
        <..tr..>
            <..td align=center><..H1>Your mail was sent</H1..></td..>
        <../tr..>
        <..tr..> 
            <..td..><..u..>To<../u..>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<..font color="red"..><..%=strTo%..><../font..><../td..>
        <../tr..>
        <..tr..>
            <..td..><..u..>From<../u..>:&nbsp;&nbsp;&nbsp;&nbsp;<..font color="red"..><..%=strFrom%..><../font..><../td..>
        <../tr..>
        <..tr..>
            <..td..><..u..>Subject<../u..>:&nbsp;<..font color="red"..><..%=strSubject%..><../font..><../td..>
        <../tr..>
        <..tr..>
    		<..td..><..u..>Message<../u..>:<..BR..>&nbsp;<..BR..><..f..ont color="red"..><..%=strMessage%..><../font..><../td..>
    	<../tr>
    <../Table..>
    <../BODY..>
    <../HTML..>
    
     
  11. Talismanic

    Talismanic

    Joined:
    May 25, 2000
    Messages:
    409
    Sorry about the dead link above. I have updated the demo so that it is a working example. On the second page you will get all the code exactly as it is inside the two pages.

    Here is the new link:

    Sending form contents in email (CDONTS)
     
  12. DJ P@CkMaN

    DJ [email protected] Thread Starter

    Joined:
    Aug 8, 2001
    Messages:
    413
    thanx heaps people.. u hve helped me heaps
     
  13. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/61097

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice