need some instruction on form

Discussion in 'Web Programming' started by DaveHester, Nov 23, 2016.

need some instruction on form
  1. Unread #1 - Nov 23, 2016 at 9:07 PM
  2. DaveHester
    Joined:
    Sep 4, 2014
    Posts:
    642
    Referrals:
    2
    Sythe Gold:
    363

    DaveHester Apprentice

    need some instruction on form

    made a website for a family member but im pretty basic when it comes to html but no clue how exactly this form is suppose to work. basically im trying to make a form send the info to a email address but not sure how exactly how to set it up and make it actually work if someone could help me with this would be greatly appreciated.


    Code:
    <form action=" http://mailto:[email protected]" method="post" enctype="text/plain">
    
      Name:<br>
    <input type="text" name="name"><br>
    E-mail:<br>
    <input type="text" name="mail"><br>
    Phone:<br>
    <input type="text" name="phone"><br>
    Comment:<br>
    <input type="text" name="comment" size="50"><br><br>
    <input type="submit" value="Send">
    <input type="reset" value="Reset">
    </form>
     
  3. Unread #2 - Nov 24, 2016 at 4:39 AM
  4. kmjt
    Joined:
    Aug 21, 2009
    Posts:
    14,450
    Referrals:
    8
    Sythe Gold:
    449

    kmjt -.- The nocturnal life chose me -.-
    Banned

    need some instruction on form

    Form validation (at least on phone number)
     
  5. Unread #3 - Nov 24, 2016 at 12:35 PM
  6. 70i
    Joined:
    Jan 11, 2014
    Posts:
    462
    Referrals:
    0
    Sythe Gold:
    174

    70i Forum Addict
    Banned

    need some instruction on form

  7. Unread #4 - Jan 22, 2017 at 8:17 AM
  8. murinsh
    Joined:
    Jul 25, 2016
    Posts:
    40
    Referrals:
    0
    Sythe Gold:
    47

    murinsh Member
    Banned

    need some instruction on form

    I don't get why W3Schools is piece of garbage, it gives really nice fundementals to get started.

    As for the question, you can't send email with just html form, you need to look in to php and SMTP (Simple Mail Transfer Protocol)
     
  9. Unread #5 - Jan 22, 2017 at 1:47 PM
  10. 70i
    Joined:
    Jan 11, 2014
    Posts:
    462
    Referrals:
    0
    Sythe Gold:
    174

    70i Forum Addict
    Banned

    need some instruction on form

    The code on that site usually works, but just for one case. If you have practical requirements w3schools is not going to be enough.

    For instance let's say you want a checkbox for your website. You could go to HTML input checked Attribute

    But then you realize you want the users to be able to click the label beneath the checkbox to register as checking the box. You can look anywhere on their site and it won't tell you how to do this, not even in their "reference". Nor do they provide links to html's specification that specifies all of html's available features.

    On the other hand, if you had the same requirement and went to MDN <input type="checkbox">. It shows you how to do that in the example. If you needed something else that's not covered in the example at least it gives you a reference to HTML's specification where you can see all of HTML's features HTML Standard

    HTML is the simplest language W3Schools covers, and learning this way is much worse with the more complicated languages W3Schools tries to teach.

    TLDR W3Schools isn't scalable. They'll give you a fish, but won't teach you to fish.
     
  11. Unread #6 - Jul 21, 2017 at 6:04 AM
  12. Viral_
    Joined:
    Jul 21, 2017
    Posts:
    2,483
    Referrals:
    1
    Sythe Gold:
    3,211
    Discord Unique ID:
    827322595988865025

    Viral_ Grand Master

    need some instruction on form

    Revised Code:

    HTML:
    <form action="send.php" method="post" enctype="text/plain">
      <div class="form-group">
        <label>Email:</label>
        <input type="text" name="email" class="form-control">
      </div>
      <div class="form-group">
        <label>Phone:</label>
        <input type="text" name="phone" class="form-control">
      </div>
      <div class="form-group">
        <label>Comment:</label>
        <textarea rows="5" class="form-control" name="comment"></texarea>
      </div>
      <div class="form-group">
        <input type="submit" name="send" class="btn btn-primary">
      </div>
    </form>
    send.php

    PHP:
    <?PHP

      
    if(isset($_POST['send']) && !empty($_POST['send'])) {
        
    $email $_POST['email'];
        
    $phone $_POST['phone'];
        
    $comment $_POST['comment'];

        
    $htmlEmail '';
        
    $htmlEmail .= '<p><span style="font-weight:600">Phone:</span> '.$phone.'</p>';
        
    $htmlEmail .= '<p><span style="font-weight:600">Comment:</span> '.$comment.'</p>';
        
    mail($email'Test Email'$htmlEmail);
      }
    ?>
     
< | >

Users viewing this thread
1 guest


 
 
Adblock breaks this site