Solved

Building my very first online form

Posted on 2008-10-18
12
240 Views
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!
0
Comment
Question by:piyushdabomb
  • 6
  • 5
12 Comments
 
LVL 44

Expert Comment

by:scrathcyboy
Comment Utility
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.
0
 
LVL 12

Accepted Solution

by:
adrian_brooks earned 500 total points
Comment Utility
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.

~A~
<!-- 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" />

</form>

<!-- END OF FILE: index.html -->
 

<!-- START OF FILE: send_rqst.php -->

<?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.";

sleep(3);

header('Location: http://www.you-site.com/index.html');

?>

<!-- END OF FILE: send_rqst.php -->

Open in new window

0
 

Author Comment

by:piyushdabomb
Comment Utility
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.
0
 
LVL 12

Expert Comment

by:adrian_brooks
Comment Utility
> 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.

~A~

0
 

Author Comment

by:piyushdabomb
Comment Utility
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!

0
 

Author Comment

by:piyushdabomb
Comment Utility
Hi.

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?
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

Author Comment

by:piyushdabomb
Comment Utility
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.
0
 
LVL 12

Expert Comment

by:adrian_brooks
Comment Utility
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. :)
0
 

Author Comment

by:piyushdabomb
Comment Utility
Adrian,

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

Expert Comment

by:adrian_brooks
Comment Utility
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.

http://www.coffeecup.com/free-editor/

I use Dreamweaver CS3.
0
 

Author Comment

by:piyushdabomb
Comment Utility
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).

http://www.cebdata.com/FTP_ARF_TEST.htm

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!
0
 
LVL 12

Expert Comment

by:adrian_brooks
Comment Utility
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. :)

~A~
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Showing your events from Google Calendar in Google Maps Why? I travel all week and I thought it would be ideal if staff in office knew where I was based on my calendar. (OK real reason: my son wanted to see where I would be working, and I thoug…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
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 …

743 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now