0

I cant seem to get my contact form working. Here is my contact form code:

<form action="MAILTO: Dana@dogmother.ca" method="post" >
                <div class="to">
                    <input type="text" class="text" value="Name" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Name';}"style="margin-left: 10px">
                    <input type="text" class="text" value="Email" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Email';}" style="margin-left: 10px">
                </div>
                <div class="to">
                    <input type="text" class="numbers" value="Phone Number" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Phone Number';}"style="margin-left: 10px">
                    <input type="text" class="text" value="Subject" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Subject';}" style="margin-left: 10px">
                </div>
                <div class="text">
                   <textarea value="Message:" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Message';}">Message:</textarea>
                </div>
                <div>
                    <a href="#" class="submit">Submit</a>
                </div>
           </form>

I have tried changing the mailto to my address and it still hasn't sent then I saw the submit button with a herf link but I don't know if I need to use or how to use that to make it work.

j08691
  • 204,283
  • 31
  • 260
  • 272

5 Answers5

1

Some of the things you are missing: - Submit button should be an input type submit or a button.

<input type="submit" name="submit" value="Send" />

Anchors that are not told to action the form won't do a thing.

  • None of your input's have names. Forms submit in name/value pairs. If you don't name your value it won't work, for example:

<input name='Name' type="text" class="text" value="Name" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Name';}"style="margin-left: 10px">

See this tutorial to see what else you might be missing.

scrappedcola
  • 10,423
  • 1
  • 32
  • 43
0

Your submit button doesn't do anything. Try:

<input class="submit" type="submit" value="Send">
VikingBlooded
  • 884
  • 1
  • 6
  • 17
0

You need a submit button, not a link, and names for your inputs:

jsFiddle example

<form action="MAILTO: Dana@dogmother.ca" method="post" enctype="text/plain">
  <div class="to">
    <input type="text" class="text" name="name" value="Name" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Name';}" style="margin-left: 10px">
    <input type="text" class="text" name="email" value="Email" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Email';}" style="margin-left: 10px">
  </div>
  <div class="to">
    <input type="text" class="numbers" name="phone" value="Phone Number" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Phone Number';}" style="margin-left: 10px">
    <input type="text" class="text" name="subject" value="Subject" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Subject';}" style="margin-left: 10px">
  </div>
  <div class="text">
    <textarea value="Message:" name="message" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Message';}">Message:</textarea>
  </div>
  <div>
    <input type="submit" value="Send">
  </div>
</form>

By on a side note, this is highly unadvisable. You should use a real mailing script and not rely on the client to actually create and send the email.

j08691
  • 204,283
  • 31
  • 260
  • 272
-1

you should do it like this:

<form action="process.php" method="post">
    <!-- form stuff like inputs, etc. -->
</form>

and in your process.php file use mail() function ike this:

mail("Dana@dogmother.ca","My subject","This is the message");
Peyman Mohamadpour
  • 17,954
  • 24
  • 89
  • 100
-1

<form> works only with http protocol by its definition.

To send email using default email application you can use ordinary <a> element and compose its href attribute.

Try this:

<a href="mailto:example@example.com?subject=hello&body=world">Email Me!</a>
c-smile
  • 26,734
  • 7
  • 59
  • 86