Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Forms - How to make them work..

Forms - How to make them work..
Thread Tools
Raymate
Fresh-Faced Recruit
Join Date: Jul 2002
Location: UK
Status: Offline
Reply With Quote
Jul 23, 2002, 06:28 PM
 
Hope someone can advise or point me in the right direction. I use GoLive and have done for 3 years. I want to use forms, I can make forms but have not worked out how to make them work. To start with I want to build a simple form that will have some tick boxes and drop down selection. The user will type in email address and select some information from the menus, then the result is mailed to me.

How do i do it

Thanks

Ray <img border="0" title="" alt="[Frown]" src="frown.gif" />
MaBook 1.83 (100 gig - 2 gig)
17" PowerBook G4 1.67Ghz HD screen (100 gig - 2 gig)
G4 1.25Ghz Duel (2 gb - 160 gig RAID S - 200 gig RAID M - OS 9 BOOT version)

http://www.applemk.co.uk
     
philzilla
Occasionally Useful
Join Date: Jun 2001
Location: Liverpool, UK
Status: Offline
Reply With Quote
Jul 23, 2002, 06:56 PM
 
if you already know how to make the actual form, then your first line should be something like:
</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">&lt;form name=&quot;contact&quot; method=&quot;post&quot; action=&quot;http://www.yourdomain.com/cgi-bin/FormMail.pl&quot;&gt;</pre><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">do you have cgi-bin access?
"Have sharp knives. Be creative. Cook to music" ~ maxelson
     
Vasudevelopa
Fresh-Faced Recruit
Join Date: May 2002
Location: Ft Lauderdale
Status: Offline
Reply With Quote
Jul 23, 2002, 08:21 PM
 
Here is a simple HTML form to get you started:
</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">&lt;form action='script.php' method='get'&gt;
&lt;input type='text' size='30' name='txtField'&gt;&lt;/input&gt;
&lt;input type='submit' value='Go'&gt;&lt;/input&gt;
&lt;/form&gt;</pre><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">This will send the value in the text field to script.php for processing.

If you have PHP installed and configured to send mail:
</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">&lt;?php
$mail_to = &quot;[email protected]&quot;;
$mail_subject = &quot;subject&quot;;
$mail_body = &quot;body\n&quot;;
$mail_body .= &quot;next line of body\n&quot;;
$mail_body .= &quot;you entered: &quot; . $txtField;

if (mail($mail_to, $mail_subject, $mail_body)) {
echo &quot;Success.&quot;;
} else {
echo &quot;Failed.&quot;;
}
?&gt;</pre><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">Good luck.
     
Raman
Mac Elite
Join Date: Mar 2001
Status: Offline
Reply With Quote
Jul 25, 2002, 03:51 PM
 
What server side language are you using or is your server capable of? People in here seem to automatically ASSume that you're using *nix with perl or php.
     
Raymate  (op)
Fresh-Faced Recruit
Join Date: Jul 2002
Location: UK
Status: Offline
Reply With Quote
Jul 25, 2002, 06:16 PM
 
Thanks guys, I have not had chance to try anything yet. But to answer your question Raman. All i know is the domain is a full IIS Virtual Server running on Windows 2000. All my domains are with <a href="http://www.fasthosts.co.uk/" target="_blank">http://www.fasthosts.co.uk/</a>

Ray
MaBook 1.83 (100 gig - 2 gig)
17" PowerBook G4 1.67Ghz HD screen (100 gig - 2 gig)
G4 1.25Ghz Duel (2 gb - 160 gig RAID S - 200 gig RAID M - OS 9 BOOT version)

http://www.applemk.co.uk
     
Raymate  (op)
Fresh-Faced Recruit
Join Date: Jul 2002
Location: UK
Status: Offline
Reply With Quote
Jul 28, 2002, 04:07 PM
 
Vasudevelopa,

I tried the script but when you hit the GO button a file called script.php is created on my desktop.

I copied and pasted your code into a file and saved it as text, then uploaded it into my CGI-BIN

Any ideas.

After some searching around on the net I have now found info about CGI and how it work. I can now create form no problem. All I need is a small CGI that will send the complete contents of the form back to my email address.

Ray
MaBook 1.83 (100 gig - 2 gig)
17" PowerBook G4 1.67Ghz HD screen (100 gig - 2 gig)
G4 1.25Ghz Duel (2 gb - 160 gig RAID S - 200 gig RAID M - OS 9 BOOT version)

http://www.applemk.co.uk
     
hyperizer
Dedicated MacNNer
Join Date: Jan 2001
Location: Santa Fe
Status: Offline
Reply With Quote
Jul 28, 2002, 06:46 PM
 
You can <a href="http://www.scriptarchive.com/formmail.html" target="_blank">get FormMail here.</a> You will need to modify the script to point to your server's Perl interpreter, to its copy of sendmail, and to make your site a valid referrer. There is a readme with instructions at the above site. Finally, you'll have to make sure the permissions in your cgi-bin are set properly so your users can execute the files placed there. I'm guessing you'll need the help of your host to do all of the above. Good luck!
     
derbs
Senior User
Join Date: May 2001
Location: Nottingham, UK
Status: Offline
Reply With Quote
Jul 28, 2002, 07:01 PM
 
it's a simple process on windows 2000

i'll post the 'CGI' code (it's actually asp code) tomorrow when i'm at work. Going to bed now
     
Raman
Mac Elite
Join Date: Mar 2001
Status: Offline
Reply With Quote
Jul 28, 2002, 08:23 PM
 
</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">quote:</font><hr /><font size="1" face="Geneva, Verdana, Arial, sans-serif">Originally posted by Raymate:
<strong>Thanks guys, I have not had chance to try anything yet. But to answer your question Raman. All i know is the domain is a full IIS Virtual Server running on Windows 2000. All my domains are with <a href="http://www.fasthosts.co.uk/" target="_blank">http://www.fasthosts.co.uk/</a>

Ray</strong></font><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">O.K. you just need to know 1 piece of information from your web host. Ask them what the name or I.P. address of your mail host is. Tell them you want to make a web form that can send email. Once you get the name of your mail host (it's prolly something like smtp.yourdomain.com or mail.yourdomain.com). I'm assuming that you're NOT doing the "home" account and have at least teh "business" account because fasthosts says asp isnt' supported in "home" accounts. You may also want to ask them if they let you use CDONTS (the mail component that comes with windows 2000) or if they have ASPEMAIL or ASPQMAIL or another component that lets you do email from a ASP page (if they don't have CDONTS). Let me know. The code's pretty easy once you know these 2 pieces of information.
     
Raymate  (op)
Fresh-Faced Recruit
Join Date: Jul 2002
Location: UK
Status: Offline
Reply With Quote
Jul 30, 2002, 01:51 AM
 
Got a replt from fasthosts RAMAN:

"Yes you can use CDONTS on our Windows servers, you can also use Jmail [ver 3.7], CDO for Windows 2000, iHTML and BLAT [for Perl scripting] to send email from our system.
For those that require the SMTP server address, this is set to smtp.<thedomainname>.
For some example formmail scripts on our system you can go to <a href="http://scriptdemos.fasthosts.co.uk" target="_blank">http://scriptdemos.fasthosts.co.uk</a> and download some examples"
MaBook 1.83 (100 gig - 2 gig)
17" PowerBook G4 1.67Ghz HD screen (100 gig - 2 gig)
G4 1.25Ghz Duel (2 gb - 160 gig RAID S - 200 gig RAID M - OS 9 BOOT version)

http://www.applemk.co.uk
     
derbs
Senior User
Join Date: May 2001
Location: Nottingham, UK
Status: Offline
Reply With Quote
Jul 30, 2002, 07:10 AM
 
hi there - totally forgot to reply yesterday

Anyway, using CDONTS is pretty simple. You need 2 pages. One for the actual form, and then one to send the email.

Call the first one whatever you like, call the second one something like mailout.asp

eg. form.asp
Create your form in this page. I guess you know how to do this? If not let me know and i'll post you some code.

goLive will probably put a [form] and [/form] on either side of your form elements.

Change the [form] to read [form action="mailout.asp" method="POST"]
The action= tells the form to send the data to the page mailout.asp

*** btw change the [ ] to < and > - it won't let me use the proper brackets
     
derbs
Senior User
Join Date: May 2001
Location: Nottingham, UK
Status: Offline
Reply With Quote
Jul 30, 2002, 07:15 AM
 
double post <img border="0" title="" alt="[Frown]" src="frown.gif" />

<small>[ 07-30-2002, 07:25 AM: Message edited by: derbs ]</small>
     
derbs
Senior User
Join Date: May 2001
Location: Nottingham, UK
Status: Offline
Reply With Quote
Jul 30, 2002, 07:25 AM
 
ugh double post :::

what a muppet

<small>[ 07-30-2002, 07:26 AM: Message edited by: derbs ]</small>
     
derbs
Senior User
Join Date: May 2001
Location: Nottingham, UK
Status: Offline
Reply With Quote
Jul 30, 2002, 07:27 AM
 
Secondly, create a page called mailout.asp

Do not have any HTML here. Just a blank page with the code looking like this:

(it's best to do this in BBEdit or text editor)

[%
theEmail = Request.Form("email")
theName = Request.Form("name")
' here you are requesting the information that was put into the text fields called email and name, or whatever you called them
' they have been put into variables called theEmail and theName so you can reference them later

TheMessage=" ------ you have an email from you website " &vbcrlf
TheMessage=TheMessage&" Name = " &theName &vbcrlf
TheMessage=TheMessage&" email = " &theEmail &vbcrlf

' here you have created a variable called TheMessage. It is formatted with vbcrlf, which is a asp term for a return (carriage return)

' now we just need to set up the email

TheRecipient="[email protected]"
TheWhoFrom="[email protected]"
TheSubject="Email message"

' these three lines are pretty self explanatory - put you email address in TheRecipient, leave TheWhoFrom as it is, and change TheSubject to whatever you want

set myMailMessage = server.createobject("CDONTS.Newmail")
myMailMessage.to = TheRecipient
myMailMessage.from = TheWhoFrom
myMailMessage.body = TheMessage
myMailMessage.subject = TheSubject
myMailMessage.send
set myMailMessage = nothing

' email has been sent!

response.redirect("thanks.htm")

' this redirects you to a thankyou page, change the thanks.htm to whatever you want

%]

Remember to change the [ and ] to < and >
That's all it is. Let me know if you have any problems.
     
Raymate  (op)
Fresh-Faced Recruit
Join Date: Jul 2002
Location: UK
Status: Offline
Reply With Quote
Jul 30, 2002, 01:32 PM
 
DERBS, Thanks for the info, its almost working:

I created two files as you said but when I submit the form i get this message: "Server Application Error
The server has encountered an error while loading an application during the processing of your request. Please refer to the event log for more detail information. Please contact the server administrator for assistance"

My "Mailout.asp" is as follows:

[%
theEmail = Request.Form("email")
theName = Request.Form("name")
' here you are requesting the information that was put into the text fields called email and name, or whatever you called them
' they have been put into variables called theEmail and theName so you can reference them later
TheMessage=" ------ you have an email from you website " &vbcrlf
TheMessage=TheMessage&" Name = " &theName &vbcrlf
TheMessage=TheMessage&" email = " &theEmail &vbcrlf
' here you have created a variable called TheMessage. It is formatted with vbcrlf, which is a asp term for a return (carriage return)
' now we just need to set up the email
TheRecipient="[email protected]"
TheWhoFrom="[email protected]"
TheSubject="Email message"
' these three lines are pretty self explanatory - put you email address in TheRecipient, leave TheWhoFrom as it is, and change TheSubject to whatever you want
set myMailMessage = server.createobject("CDONTS.Newmail")
myMailMessage.to = TheRecipient
myMailMessage.from = TheWhoFrom
myMailMessage.body = TheMessage
myMailMessage.subject = TheSubject
myMailMessage.send
set myMailMessage = nothing
' email has been sent!
response.redirect("thanks.html")
' this redirects you to a thankyou page, change the thanks.htm to whatever you want
%]

and my "form.html" is:

Go to <a href="http://www.designannex.co.uk/form.html" target="_blank">http://www.designannex.co.uk/form.html</a>

If you want to check my code.
MaBook 1.83 (100 gig - 2 gig)
17" PowerBook G4 1.67Ghz HD screen (100 gig - 2 gig)
G4 1.25Ghz Duel (2 gb - 160 gig RAID S - 200 gig RAID M - OS 9 BOOT version)

http://www.applemk.co.uk
     
Raman
Mac Elite
Join Date: Mar 2001
Status: Offline
Reply With Quote
Jul 30, 2002, 03:58 PM
 
I'll post code tonite. You just need 1 page that has teh form that submits to itself - teh asp code at the top will send the email as long as all the necessary fields are filled out.

Bug me on AIM if I haven't replied.

BTW, your first and last name textfields are both named name="textfieldName", you should change them to be uniqu (ie. textfieldFName and textfieldLName or something.

-Raman
     
   
Thread Tools
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 04:14 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,