UGN Security

How To Make A Form With The Use Of HTML Opposed To CGI

Posted By: BackSlash

How To Make A Form With The Use Of HTML Opposed To CGI - 03/17/02 01:01 AM


I used to envy everyone with forms on their pages because I wanted them on my site. However with no access to CGI I thought it was impossible to create a form of any kind. I was wrong. In fact, it is quite simple to create a working form, and it will take less time than expected.

Materials Needed

1. Text Editor (such as notepad)
2. WYSIWYG Editor (if you feel like editing the hmtl code through that)
3. An Email Address
4. This Tutorial

How Its Done

The first part of making a form is to start with the correct command to let the browser know a form is starting.

<FORM METHOD="POST" ACTION="mailto:your address">

Notice that it tells the browser a form is starting, the form will post the info, and the info will be posted/emailed to the designated email address.


The next step is to decide how you would like the user of this form to enter the information. There are several options.

Option 1: A Text Box

A text box is a one character high box that allows the user to write in it. The code is below. Note that the "text" command tells the browser it will be a text box, the "name" command tells the browser the name of the text box, and the "size" command tells the browser how long to make the box.

<INPUT TYPE="text" NAME="name" SIZE="45">

As with this type of input and all the others, you must replace the "name" with what the user will be placing in the text box. The user will not be able to see this name, but when the info is sent to you through your email you will need this designated to know what the users answer corresponds with. Please take note of this because I will not cover it again.

Option 2: The Text Area Box

This is simply a larger version of the text box which allows for mulitiple lines of text. The code is below. It is much the same as the text box with "rows" telling how tall it will be, and "cols" telling how many characters will be in each row.

<TEXTAREA NAME="comment" ROWS=7 COLS=49>

Notice that the text area box requires a </TEXTAREA> as the text box did not.

Option 3: The Radio Button

The radio button is used for a question with several answers. The code is below. Note that only one radio button can be marked per question.

<INPUT TYPE="radio" NAME="heading" VALUE="name">

Look at the code and see that when using multiple radio buttons for one question you would have all the radio buttons with the same "name" but diff "values".

Option 4: The Check Box

Exact same as the radio button except that you can check more than one answer for a question and it appears as a box opposed to a circle like the radio button. The code is below.

<INPUT TYPE="checkbox" NAME="somethin" VALUE="somethin">

Option 5: The Pull Down Menu

The pull down lets you click a down arrow to view several options. You have all seen these in action at various forms. The code is below. Note that the "name" is what will be emailed to you, the "size" tells how many options will be displayed at once (recommend one), the "option selected" is the one that will be shown, and the "option" are the other choices. Not as hard as it may appear.

<SELECT NAME="Favorite Band" SIZE="1">


Next you must put a send button on your page to allow your user to send you the info in the form. This is vital (obviously). The code is below.

<INPUT TYPE="submit">

If you want a reset button on your page use the below code.

<INPUT TYPE="reset">


And, to finish the form off don't forget to close it with the below code.



Please let me know how helpful this is to you, because I will base any later posts on your feedback. If you want to know anything in particular about html post it on the board and I will write a tutorial for it.

Posted By: SilentRage

Re: How To Make A Form With The Use Of HTML Opposed To CGI - 03/17/02 05:48 PM

however this isn't nearly as good as a real CGI form because doing this: "mailto:your address" sends the email on the client's computer. This requires having a default mail client setup which accepts sending emails (like Outlook Express). I and many other people do not have it setup and therefor the form does not work. Also, I don't think any linux user would find that it works either.

However, when you don't have CGI access, there's no alternative to making at least a FEW people happy - except getting yourself a different host...
Posted By: BackSlash

Re: How To Make A Form With The Use Of HTML Opposed To CGI - 03/18/02 04:40 PM

This is all true SilentRage. Also, another anyone planning to use this might want to be aware that when the data is sent to you it will not seperate each question and can be rather difficult to read. However, as you said, this is the best option if CGI is not available. Either this or end up with one of those free CGI providers that will throw ads all over your site, lol.

Posted By: SilentRage

Re: How To Make A Form With The Use Of HTML Opposed To CGI - 03/18/02 06:09 PM

Before I started hosting myself, I did have a free host with CGI, MySQL, PHP, SSI, and FTP access aaaaaaand no ads! It was a neat find. They shutdown since then though.

They're out there dude.
© 2018 UGN Security Forum