Obligatory disclaimer: I have no idea what i'm doing. I know how to make web pages look pretty, and that's about it. Thank all you fine people for humoring me.
Situation: I've managed to make a really pretty form here. I've been trying to teach myself how to make it work, reading through tutorials here.
Question: I'm not quite sure where the infor actually goes when someone hits "submit." Can I make it go to an email address? I tried the tutorial on that page, and it makes it open mail rather than sending the information. What I'd like to do is make the information go into an email and send the submitter to another page that says "Thank you for submitting."
Any ideas on how I can make this work?
Posted by Bokonon (Member # 480) on :
The form handling usually requires plugins to your server system that you can interface with, or require coding of some sort.
-Bok
Posted by Hobbes (Member # 433) on :
You can make it go to an e-mail (give me a sec and I'll post how), the other option is submitting it to a CGI program of some sort (probably Perl). Perl's a good thing to know, but I'm going to assume that for this you don't really want to go to the trouble of learning a programming language so I'll try to remember the e-mail one and tell you.
I'd be happy to sit down and help you putz with the code if you like - sit down as in skim the site, look at your code and do some research.
-Trevor
Posted by fugu13 (Member # 2859) on :
Plus it'll just fail on a computer without an application set up to handle mail, or the application set up to handle mail not having an SMTP server set up (many windows users use web mail, but still have Outlook Express set as the default mail handler, with no accounts defined).
Posted by fugu13 (Member # 2859) on :
The formmail script I pointed you at will do anything you need to do.
Posted by Hobbes (Member # 433) on :
Ohh, it was a while ago I did this...
Hobbes Posted by Annie (Member # 295) on :
That would be great, Trevor. I'm trying to use these forms in two sites I'm working on.
And where did I get the code in the first place? I have my ways. Posted by Annie (Member # 295) on :
By the way, Hatrack boys ROCK.
Posted by TMedina (Member # 6649) on :
I'm an idiot...ok...trying plan B.
-Trevor
Posted by TMedina (Member # 6649) on :
After much crunching and muttering, I can make the "mailto:" command work, but as it has been pointed out, will not do wonders for customers who haven't configured their email programs or browser programs.
Plan B would involve loading a CGI to the server which generates the email directly without requiring client-side access.
-Trevor
Posted by fugu13 (Member # 2859) on :
http://www.dtheatre.com/scripts/formmail_doc.php describes how to set it up in many imaginable situations. Can you link to the form you'd like to use? I can show you how you'd modify it to work with the formmail script.
Posted by Nato (Member # 1448) on :
That looks like a useful script, fugu.
Posted by fugu13 (Member # 2859) on :
Oops, completely forgot about that link at the top.
Lets see, first you need to enclose all your form elements in
code:
<form action="formmail.php" action="POST">
</form>
Then you want to change the name of the email field to email (lower case), the phone field to phone_no, and rename the title field to something like job_title (so the formmail script doesn't think its one of its special variables).
<input type="hidden" name="redirect" value="URL page I want redirected to upon a successful result" />
<input type="hidden" name="missing_fields_redirect" value="URL of page for missing fields which states which fields should be filled in and says the person should hit their back button to return to the form" />
<input type="hidden" name="sort" value="order: put the names of the fields you want in the order you want to see them appear in the email, separated by commas" />
<input type="hidden" name="subject" value="Desired Subject of the email" />
In the script itself (after you download it, before you upload it), you want to make the line that defines $recipient look like the following:
code:
$recipient = "email_to_send_to@example.org";
and the line that defines $referers look like the following:
Upload the formmail script, and it should probably work right off.
[ July 07, 2004, 09:23 PM: Message edited by: fugu13 ]
Posted by fugu13 (Member # 2859) on :
*bump*
Posted by Annie (Member # 295) on :
Thanks for the info, Fugu! I've been off and on with my internet accessibility, so I just wanted you to know that I got it OK. Posted by Annie (Member # 295) on :
Can I ask if I've got this all configured correctly? I can't test it yet because I have to approve the page before uploading it to its real domain.
The one question I had is if there's any way to determine the number part of the domain name if I don't know it. Here's what I have in the formmail.php file: