Building my very first online form

Hi Webbuilder geniuses,

So here is a dillemma I've come to:

At the firm I work for, I am currently the point of contact for any FTP-related activies to include providing access to employees our our FTP client, support etc...

Recently, I've come accross many requests from not only my division but also from other departments and given the number of requests, I was thinking about the best way to handle this. I said, "Ok, why not build a simple MS Word document template for FTP access requests and send them out individually every time". I was then looking at the templates online and I realized..."Hey! Why not just build a webbased form and send out the link every time!"

I've looked online regarding building forms 101. I have an FTP server, and an MS Access database. I can't seem to figure this out. How do I make the simplest dang form that esentially allows users to fill it up, click submit, and the form gets sent to me via an attachment to my email. I know you can do this using PHP.

My question is this: Can I build a form and given that I have an FTP client server, ( is my 3rd party host)? If so, in a matter of a few hours, how do I get this done? Can somoene point me in the right dierction?

I am new to the whole website generation concept. I have frontpgae, access, this ftp client, and I can download anything not overbearing.

My Requirements:

> Users fill up their information and when clicking submit, the form is sent to me via an attachment in MS Word or PDF. I'm using outlook

> As a bonus, if I need a database to store their values, I have ms access (and thats all i can afford ecause te company is small and they can't afford much - cost wise)

Let me know your thoughts! A sample form with instructions would be awesome. I just need the basics here. I'm super new to this and i'm up for the challenge!
Who is Participating?
Richard DavisSenior Web DeveloperCommented:
Hello piyushdabomb,

The code I provide below is a rudimentary way to send an email out via PHP.
It's fairly simple and very straight forward. Let me know if you have any issues.

<!-- START OF FILE: index.html -->
<form name="sendRqst" method="post" action="send_rqst.php">
 Your Name: <input type="text" name="sndr_name" value="" />
 Your Email: <input type="text" name="sndr_email" value="" />
 Message: <textarea name="msg_body" cols="30" rows="10"></textarea>
 <input type="submit" name="submit" value="submit" />
<!-- END OF FILE: index.html -->
<!-- START OF FILE: send_rqst.php -->
  $Name = $_POST['sndr_name']; //senders name
  $email = $_POST['sndr_email']; //senders e-mail adress
  $recipient = ""; // YOUR email address
  $mail_body = $_POST['msg_body']; //mail body
  $subject = "FTP Request Mailer"; //subject
  $header = "From: ". $Name . " <" . $email . ">\r\n"; //optional headerfields 
mail($recipient, $subject, $mail_body, $header);
print "Your request has been sent to $recipient.";
<!-- END OF FILE: send_rqst.php -->

Open in new window

You can only do this with a server language like PHP or ASP.  The PHP code to send mail is only 5 lines, and is very easy.  Goggle for PHP mail script.  You cannot do it from HTML, javascript or other page language without server action.
piyushdabombAuthor Commented:
A few questions:

> How do I use the code? Where do I paste this? Do I upload this to the server called /inquiry.html ?
> Will this send out an attachment to my mail with everything as an attachment?
> Will this work in ie 6.0? I heard that some code won't work in ie 6.0 and later.
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Richard DavisSenior Web DeveloperCommented:
> How do I use the code? Where do I paste this?
If your HTML form is called inquiry.html then the element names of your form will be what is posted when the user hits submit. It may be helpful if you showed exactly what your form is supposed to be having the user fill out for me to tailor a clearer PHP solution.

>Do I upload this to the server called /inquiry.html ?
If you have the ability to edit and upload the inquiry.html to the web server, then yes, modify the form according to what you wish to obtain from the end-users and upload the edited version up to you web server.

> Will this send out an attachment to my mail with everything as an attachment?
No, this code I submitted here will not mail an email with any attachments. The reason for this is because if all the user is doing is filling out fields on a form and submitting their responses via the form, then anything you would need to obtain could all be contained within the context of the email message body itself and therefore there is no need to complicate the process by adding a layer that performs creation of a word doc or a PDF.

> Will this work in ie 6.0? I heard that some code won't work in ie 6.0 and later.
You are correct to assume that there may be potential problems with using IE 6, but due to the fact that the form is a standard web form and is not bound to any higher level client-side activities, then IE 6 should not experience any problems whatsoever with regard to proper operation for the submission of this form.

As for the second half of my code that I included...everything between the opening <?php and closing ?> tags (inclusive) should be saved to a file called send_rqst.php and uploaded to your web server in a location that is accessible by the rest of the site. (e.g. the inquiry.html directory would be a good place to store this file)

I hope that these answers shed more clarity on your issue. I will gladly help you through the rest of the way, but send me a copy of the inquiry.html so that I may tailor the PHP file to match what you're sending from the form upon submission.


piyushdabombAuthor Commented:
The reason why I would like to get the documents sent as attachments is because I'm building macros using VBA that will eventually work with the data in the doc or pdf files.

I'm going to try the form out shortly. Thanks!

piyushdabombAuthor Commented:

Ok, I just attempted uploading this code to /test123.html. You can find the form at

I changed the following line of code to: $recipient = ""; // YOUR email address my email address. I sent out a test mail but I never received anything. Try it out for yourself. What am I doing wrong?
piyushdabombAuthor Commented:
Ok, I was able to figure the issue out. I needed a document called .htaccess and include an authentication line to let the form know where the email is coming from.

Last question - can I use MS Word to build my form and then publish it using the code? I don't have frontpage or any form designers. Let me know.
Richard DavisSenior Web DeveloperCommented:
hi again,

Glad that you figured out what went wrong on that part. As for using Word to create your form, you can, yes. I personally have never tried that, so I'm not entirely sure what the resulting file will contain. But I should hope that Microsoft was kind enough to not over complicate something as simple as an HTML form.

I would be curious what you end up with. Feel free to post the resulting html file here for me to have a look at. :)
piyushdabombAuthor Commented:

Very cool. Give me till tomorrow and I'll give you an update. What web-builders do you use? I can't seem to find anything free and superior.
Richard DavisSenior Web DeveloperCommented:
Indeed...let me see what you turn out. On the other for free HTML editors. I believe you could try Coffee Cup. It's free.

I use Dreamweaver CS3.
piyushdabombAuthor Commented:
Okay, I'm pretty much finished with the online form. When you click submit, it mails the form to the appropriate user (in this case, its me).

I can't seem to find my logo, its missing from the form. Adrian - how do I send the form to multiple email addresses? I'm using the syntax: mail($recipient, $subject, $mail_body, null, $extraparams);

Note that I'm not using .htaccess but rather using

Let me know your thoughts!
Richard DavisSenior Web DeveloperCommented:
Hi again.

To send to multiple email addresses simply make the $recipient variable in your PHP script look like this;

$recipient = ",";

You can add as many addresses as you desire this way then. :)

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.