I'm in the process of developing a basic contact form that includes input fields for name and subject, as well as a send button (which is an <a>
element inside a <div>
. I am utilizing an <a> tag
because I intend to use mailto functionality).
My goal is to transfer the entered name and subject from the form to the email upon clicking "send".
Could you please provide guidance on how to achieve this?
Here is the link to the Jsfiddle
Below is my code snippet:
p{
width:50%;
color: #666;
text-align: center;
margin: 0 auto;
}
.name_input{
display:block;
margin : 50px auto;
padding-left:10px;
border-radius:5px;
border:2px solid rgb(255,194,0);
width: 50%;
height:30px;
}
.btn{
text-align:center;
background-color:rgb(255,194,0);
padding:10px;
margin: 10px auto;
width:30%;
cursor :pointer;
}
.btn:hover{
background-color: #666;
}
a{
text-decoration:none;
color:#FFF;
}
<form>
<p>
Enter the subject and your name, click "send" to have the subject included in the email subject line, and your name in the email body.
</p>
<input class="name_input" type="text" name="contact-object" id="contact-object" placeholder="The object"/>
<input class="name_input" type="text" name="contact-name" id="contact-name" placeholder="Your name"/>
<div class="btn">
<a href="mailto:www.myWebSite.com?subject=THE OBJECT DYNAMICALLY &body=THE NAME DYNAMICALLY">send</a>
</div>
</form>