Learn how to a build a cloud-first strategyRegister Now


Building my very first online form

Posted on 2008-10-18
Medium Priority
Last Modified: 2013-12-13
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, (http://www.mosso.com/ 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!
Question by:piyushdabomb
  • 6
  • 5
LVL 44

Expert Comment

ID: 22749554
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.
LVL 12

Accepted Solution

Richard Davis earned 2000 total points
ID: 22750139
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 = "PersonWhoGetsIt@emailadress.com"; // 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.";
header('Location: http://www.you-site.com/index.html');
<!-- END OF FILE: send_rqst.php -->

Open in new window


Author Comment

ID: 22750511
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.

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

LVL 12

Expert Comment

by:Richard Davis
ID: 22750840
> 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.



Author Comment

ID: 22751046
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!


Author Comment

ID: 22753253

Ok, I just attempted uploading this code to /test123.html. You can find the form at http://www.cebdata.com/test123.html/

I changed the following line of code to: $recipient = "PersonWhoGetsIt@emailadress.com"; // YOUR email address

...to my email address. I sent out a test mail but I never received anything. Try it out for yourself. What am I doing wrong?

Author Comment

ID: 22753492
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.
LVL 12

Expert Comment

by:Richard Davis
ID: 22753677
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. :)

Author Comment

ID: 22754683

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.
LVL 12

Expert Comment

by:Richard Davis
ID: 22754700
Indeed...let me see what you turn out. On the other hand...as for free HTML editors. I believe you could try Coffee Cup. It's free.


I use Dreamweaver CS3.

Author Comment

ID: 22767598
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 -fsabc@abc.com

Let me know your thoughts!
LVL 12

Expert Comment

by:Richard Davis
ID: 22773673
Hi again.

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

$recipient = "user@example.com, anotheruser@example.com";

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


Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Find out what you should include to make the best professional email signature for your organization.
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question