paul
paul

Reputation: 51

HTML and CSS button for form action

I am creating two contact button for two persons in HTML and CSS. My aim is while clicking on the button user will directly send them mail using outlook platform. My code for person1 is given below:

<p><form action="mailto:[email protected]" method="post" enctype="text/plain"><button class="button1" a href="mailto:[email protected]">Contact</button></p> 

It creates a contact button and while clicking on that button it shows mail id in outlook is [email protected] is perfect.

Now code for person2 is given below:

<p><form action="mailto:[email protected]" method="post" enctype="text/plain"><button class="button1" a href="mailto:mailto:[email protected]">Contact</button></p> 

But here while clicking on the Contact button instead of showing "[email protected]" id it shows id for person1 which is [email protected].

I am unable to resolve this issue.

Upvotes: 2

Views: 638

Answers (2)

s.kuznetsov
s.kuznetsov

Reputation: 15213

Just add closing tags for the form, and correct this line - a href="mailto:[email protected]".

<form action="mailto:[email protected]" method="post" enctype="text/plain">
  <button class="button1" a href="mailto:[email protected]">Contact</button>
</form>

<form action="mailto:[email protected]" method="post" enctype="text/plain">
  <button class="button1" a href="mailto:[email protected]">Contact</button>
</form>

Upvotes: 2

Shiverz
Shiverz

Reputation: 688

I think part of the problem might come from the fact that you have two apparent mistakes in your code.

First of all, you're not closing your <form> tags.

Secondly, your second link's "href" is set to : "mailto:mailto:[email protected]" instead of "mailto:[email protected]"

Making these changes fixed it for me!

Upvotes: 2

Related Questions