• Log in or sign up for an account here: https://www.sythe.org/login

need some instruction on form

DaveHester

Apprentice
Joined
Sep 4, 2014
Sythe Gold
363
Messages
642
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>
 
need some instruction on form
Form validation (at least on phone number)
 
need some instruction on form
W3Schools is really a piece of garbage. HTML mailto isn't widely supported.
Try the second answer on here:
How do I send an HTML Form in an Email .. not just MAILTO
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)
 
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)

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.
 
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);
  }
?>
 
Runescape Gamblingrunescape gambling
Back
Top