Setting Up A Form

Discussion in 'HTML & Website Design' started by gobbly2100, Sep 1, 2007.

  1. #1
    I really need some help and direction on how I go about making a form where people can enter in details and fill in boxes which can then be sent to an email address after the user clicks the submit button.

    Remember I have no clue where to begin.

    Thanks in advance!
     
    gobbly2100, Sep 1, 2007 IP
  2. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #2
    What server-side languages does your hosting provider's server have installed?
     
    Dan Schulz, Sep 1, 2007 IP
  3. gobbly2100

    gobbly2100 Banned

    Messages:
    906
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Well my 2 options are either CGI script or PHP right? I can use both of them
     
    gobbly2100, Sep 1, 2007 IP
  4. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Ok. PHP it is then (it's better than CGI).

    Do you have an idea of what form inputs you to use? (Name, email, phone, mailing address, and so forth)? In other words, what information do you want to gather?
     
    Dan Schulz, Sep 1, 2007 IP
  5. Iriathz

    Iriathz Peon

    Messages:
    200
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    For HTML, type this in for a simple text field.

    <FORM>
    Name: <INPUT><BR>
    Email: <INPUT>
    </FORM>
     
    Iriathz, Sep 1, 2007 IP
  6. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Which is inaccessible and won't work anyway since you left out the action and method attributes, not to mention the label element which has to be associated with an input element that has a corresponding ID on it.
     
    Dan Schulz, Sep 1, 2007 IP
  7. gobbly2100

    gobbly2100 Banned

    Messages:
    906
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #7
    For now all I would like is something for a contact page like:

    Name:
    Email:
    Subject:
    Message:

    Also if it could have a "Thank you for your email" message after that would make it just perfect.
     
    gobbly2100, Sep 1, 2007 IP
  8. Iriathz

    Iriathz Peon

    Messages:
    200
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #8
    <p>
    Please fill in the form below:
    <FORM>
    Name: <INPUT><BR>
    Email: <INPUT><BR>
    Subject: <INPUT><BR>
    Message: <INPUT><BR>
    </FORM>

    <em>Thankyou for your email!</em>
    </p>
     
    Iriathz, Sep 1, 2007 IP
  9. gobbly2100

    gobbly2100 Banned

    Messages:
    906
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Thanks, what would the PHP side of things be though?
     
    gobbly2100, Sep 1, 2007 IP
  10. pr0v0ke

    pr0v0ke Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    There are plenty of PHP scripts out there that you can use.
     
    pr0v0ke, Sep 1, 2007 IP
  11. Philopoemen

    Philopoemen Peon

    Messages:
    704
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    0
    #11
    No offense mate, but I think You should not give advices about things that you don't know yourself (at least so it seems).

    2 gobbly2100:

    I recommend asking a friend, which is good with PHP, to show your how to make a valid form. Remember, if you will do it yourself, without good security, then some spammers might get a hold of it and send lots of unsolicited letters, then the IP of your domain will get banned. You don't want that to happen :)
     
    Philopoemen, Sep 1, 2007 IP
  12. Iriathz

    Iriathz Peon

    Messages:
    200
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Just so you know, I'm 13, and I tried to help Gobbly out.

    What was wrong with that code? I gave him the simple html version of a form..?
     
    Iriathz, Sep 1, 2007 IP
  13. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #13
    It's inaccessible to people with disabilities and those who use the keyboard to navigate through a Web page.

    Hang on, I'm about to head home, so when I get there, I'll whip up an HTML tutorial for both of you, ok? :)
     
    Dan Schulz, Sep 1, 2007 IP
  14. Philopoemen

    Philopoemen Peon

    Messages:
    704
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    0
    #14
    What's wrong? Well, it is not functional, it does not work.

    For starters, every input needs a name, so that you can identify the values later.

    Also, instead of <form> you should use something like:
    <form action="example.com/take_form_input.php" method="post">
    ..
    ..
    </form>

    Now this at least looks like something somewhere sometimes should work ;)
     
    Philopoemen, Sep 1, 2007 IP
  15. ottoisaac

    ottoisaac Well-Known Member

    Messages:
    245
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    128
    #15
    For someone who is a complete noob at this, you could simply use a form generator such as the one found here:
    htmlbasix.com/forms.shtml

    Saves me a lot of time not needing to type the whole code myself.
    Hope this helps

    Sorry It's not linked, I'm new on this forum and it won't let me give live links.
     
    ottoisaac, Sep 1, 2007 IP
  16. Iriathz

    Iriathz Peon

    Messages:
    200
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #16
    Oh, ok, thanks for that info.

    And yeah, form generators are good. There are heaps of them too. :)
     
    Iriathz, Sep 1, 2007 IP
  17. blueparukia

    blueparukia Well-Known Member

    Messages:
    1,564
    Likes Received:
    71
    Best Answers:
    7
    Trophy Points:
    160
    #17
    OK, I'll help you out here :) This is a standard xHTML form, that will submit to a preset email address when you press the button. I have included body tags for the hell of it, but nser the form between <body> and </body>

    
    <body><form method="post" action="mailto:%20your@emailadress">
    
    
    
    <table cellpadding="2" cellspacing="0">
    <tbody>
    <tr valign="top">
    <td><label>Name:</label></td>
    <td>
    <input type="text" name="name" value="" maxlength="100" size="30" /> </td></tr>
    <tr valign="top">
    <td><label>Email Adress:</label></td>
    <td>
    <input type="text" name="email" value="" maxlength="100" size="50" /> </td></tr>
    <tr valign="top">
    <td><label>Subject:</label></td>
    <td>
    <input type="text" name="subject" value="" maxlength="100" size="30" /> </td></tr>
    <tr valign="top">
    <td><label>Message:</label></td>
    <td>
    <textarea name="message" cols="60" rows="10"></textarea><br /> </td></tr></tbody></table>                      
    
    </form>
    
    
    </body>
    Code (markup):
    I am 14, age isn't an excuse for not knowing HTML ;)

    BP
     
    blueparukia, Sep 1, 2007 IP
  18. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #18
    Most form generators suck. And you shouldn't use tables to lay out your forms either.
     
    Dan Schulz, Sep 1, 2007 IP
  19. blueparukia

    blueparukia Well-Known Member

    Messages:
    1,564
    Likes Received:
    71
    Best Answers:
    7
    Trophy Points:
    160
    #19
    Yeah, you should use divs or spans, but that is a basic form, and he can use it, if he wants to do it in divs he can,

    BP
     
    blueparukia, Sep 1, 2007 IP
  20. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #20
    Actually, fieldsets legends and labels are the appropriate markup to use here. Unfortunately, due to Microsoft being a turd, a DIV has to be added around the fieldset. To make matters worse, this breaks the rendering of legends in Firefox (and other Gecko-based browsers), so a SPAN has to be used inside the legend instead.

    Like I said, I have a write up in progress here. :)
     
    Dan Schulz, Sep 1, 2007 IP