# PHP and/or ASP



## DJ [email protected] (Aug 8, 2001)

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


----------



## Rockn (Jul 29, 2001)

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.


----------



## Talismanic (May 25, 2000)

DJ [email protected] , did you get this figured out. If not let me know and I will post an ASP solution for you.


----------



## DJ [email protected] (Aug 8, 2001)

i have not figured it out but i have decided i would prefer CGI if at all possible. but your the expert, you tell me which is easiest, CGI or ASP. also, if it would be easier, just email me with the code.

also, here are the pages i want the code for, you fill in all the info and the submit button emails it to me.

http://www.clan-abc.150m.com/join.html
http://www.clan-abc.150m.com/challenge.html

thanks


----------



## Rockn (Jul 29, 2001)

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.


----------



## DJ [email protected] (Aug 8, 2001)

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


----------



## Rockn (Jul 29, 2001)

Does the server support PHP?


----------



## Talismanic (May 25, 2000)

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.


----------



## DJ [email protected] (Aug 8, 2001)

thanks heaps


----------



## Mithrilhall (Mar 28, 2001)

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)


```
<..%@ 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..>
```


----------



## Talismanic (May 25, 2000)

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)


----------



## DJ [email protected] (Aug 8, 2001)

thanx heaps people.. u hve helped me heaps


----------

