Posted: Sun May 25, 2003 3:37 pm Post subject: [Tutorial] Forms
To make a fully working form, there are several things that u need to plan out. First u can make forms that requires the user to input text into a text box. The other form u can make is by clicking on a selection.
First of all, like all html tags, u need to start the form off with <form>.
Inside the form tag u can put different attributes, look at the example below:
As u can see there's a method attribute. It can be either post or get in those quotes, but post is the best for forms. The action there is used to run cgi script that processes the information from the form and sends an email. There are two hidden input types, with the names of recipient and redirect. The recipient one is used to send the processed info to quotes@metallicsurge.com, while the other one makes a news page appear.
Now we get into the actual form making. I will explain the text boxes first.
In this example, i put the text box inside a table, so the overall form is nice and neat. As you can remember, there's an input name, which is a unique name that u can put in to tell urself wut the info in the box is aobut. In this case, it is company, which tells us the name of the company (no duh, lol). The next type is text which is used to make a text box appear. The size will change the width of the textbox.
<form>
phone
</form>
This one is about the same except that there is a maxlength attribute. It is used to limit the number of characters in the textbox. When you ask a user to put in a telepholne number, this works very well.
<form>
Put comments<textarea name="CommentsQuestions" cols="50" rows="6"></textarea>
<form>
This is used for larger inputs from the user. In this case, it is used to get comments from the user. This is much like the message body in this forum, where u type ur message. The size can be changed by altering the cols and rows number.
K, the text stuff seems ez enough dusn't it? well now lets go on to a bit more difficult stuff.
The first thing is the pulldown selection. Here's a small example:
code:
<tr>
<td><p>Â </p>
<p>How would you like your request responded to?</p>
<p>Â </p></td>
<td>
<select name="Respondtype">
<option selected>Telephone
<option>Email
</select>
</td>
</tr>
As you can see u have the question, but make sure u have the form tags in there too. Select name is just like the input name from the text area, where u name the textarea. Now there are the option tags. U do not need to put a close tag on them, just like a list item <LI> in lists. the selected attribute just makes that option the default.
The checkbox in quotes is needed to make the checkbox appear. Name is again a way to "label" the option. The checkbox 1 here and checkbox 2 here are the names that appear on the page beside the checkbox. The value will be a name which will appear at the top of the address when u hit the submit button.
Now for radio buttons, we're almost there:
code:
<input type="radio" name="radios" value="radio1" checked><b>This is radio button 1</b><br>
<input type="radio" name="radios" value="radio2"><b>This is radio button 2</b><br>
<input type="radio" name="radios" value="radio3"><b>This is radio button 3</b><br>
<form>
This is radio button 1
This is radio button 2
This is radio button 3
</form>
Everything is pretty much the same, except that the input type is radio instead of checkbox.
For every good form, u need a submit and reset button. Here is the code for the submit button:
code:
<input type="Submit" value="Take a Look" align="MIDDLE">
<form>
</form>
The input type this time is submit. The value will be the words that appear inside the submit button, just like the submit button in our forum. The align attribute just tells the button, in this case, to line up in the middle.
Now finally, for a reset button, here is the code:
Posted: Sun May 25, 2003 3:43 pm Post subject: (No subject)
Good. Maybe some more examples would be nice, also Visuals would also have been good.
You have been Awarded: The R +40 Award
+10 for any future Tutorials
krishon
Posted: Sun May 25, 2003 3:45 pm Post subject: (No subject)
nice, thx. now to finish my ocmputers exams, i'll put as many tutorials as i can. i'll put the visuals now, let me just edit the post.
.blade2
Posted: Tue May 27, 2003 3:05 pm Post subject: (No subject)
who is this hon guy? he's talkin shit bout every1's tutorials, he should be banned! and look- and about his form tutorial doesn't he know about cgi? you can't just copy and paste that stuff and expect it to work. you have to set up the server and all to make it work. i can't believe he got awarded those bitz for that. i mean somebody who knows what they are talkin about should make one and delete his. And is Metallic surge his site nyways? Cuz it says ted livington or somethin like that on the home page. I mean he just copied the code! Is that even legal?
Whatever. there will always be dumbasses and frauds like him in the world.
blade2
P.S. And how does he expect to make more tutorials when he doesn't even know what he is talkin about? or is there gonna be some other place he is gonna steal that from???
krishon
Posted: Tue May 27, 2003 4:16 pm Post subject: (No subject)
wtf r u talkin bout, i never said nething, i just added small comments, nothing negative bout other ppl's tutorial and ted and i made that web page. dun't say nething if u have no clue wuts goin on. and i know u need cgi code to process the stuff, i just didn't put it in the tutorial. maybe ur the idiot who should be banned
Linux
Posted: Sat Apr 09, 2005 5:34 pm Post subject: forms
ok so would i need to make a cgi file to tell the forum what to do? could i see an example of a cgi file and how to make one? i would like to make a forum that would email me when it is done
wtd
Posted: Sat Apr 09, 2005 6:03 pm Post subject: Re: forms
ok so would i need to make a cgi file to tell the forum what to do? could i see an example of a cgi file and how to make one? i would like to make a forum that would email me when it is done
A simple Perl CGI script. It takes input from a form like so: