Avatar of codelevel
codelevel

asked on 

submit form

how to make the form content reach an email after form submission with some format like new line for each label and value?

name: david
phone: 111-111-1111
email: david@fsdfsdfsffsdfsd.com
comments: i want to have more details.

 
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
  <form class="form-horizontal" role="form">
    <div class="form-group">
      <label class="col-sm-2 control-label"> name </label>
      <div class="col-sm-10">
        <input id="name" type="text"  name="name">
      </div>
    </div>
    
    
    

    
    <div class="form-group">
      <label class="col-sm-2 control-label">Email</label>
      <div class="col-sm-10">
        <input id="email" type="text" name="email">
      </div>
    </div>
    
    <div class="form-group">
      <label class="col-sm-2 control-label">Phone </label>
      <div class="col-sm-10">
        <input id="phone" type="text" name="email">
      </div>
    </div>
    
     <div class="form-group">
      <label class="col-sm-2 control-label">Comments </label>
      <div class="col-sm-10">
        <textarea rows="4" cols="50" id="comments">
      </div>
    </div>
    
    <div class="row">
      <div class="col-sm-2"> </div>
      <div class="col-sm-10">
        <input type="submit" class="btn btn-default" value="Submit">
      </div>
    </div>   
  </form>
</div>
</body>
</html>

Open in new window

jQueryWeb DevelopmentHTMLCSSBootstrap

Avatar of undefined
Last Comment
Kyle Hamilton
Avatar of Rainer Jeschor
Rainer Jeschor
Flag of Germany image

Hi,
you cannot directly send mail on the client side / through client side code.
Therefore you have to do this on the server on the form Action target page.

What are you using on the server side?
PHP, ASP.NET, ...?

Thanks.
Rainer
Avatar of codelevel
codelevel

ASKER

html only. submit should open an email content and move the content.
Avatar of Kyle Hamilton
Kyle Hamilton
Flag of United States of America image

if all you need is for the email client to open, you can do it with javascript. you capture the field values w js, and generate the mailto link:

<A HREF="mailto:me@yahoo.com?Subject=subject&Body=message>send</a>

then you trigger the link, also w js.
Avatar of Kyle Hamilton
Kyle Hamilton
Flag of United States of America image

or, just forget about trigerring the link. call it directly

window.open('mailto:test@example.com?subject=subject&body=body');
Avatar of codelevel
codelevel

ASKER

how to make each label start in new line in the body? can you please put the code in my example?
SOLUTION
Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of codelevel
codelevel

ASKER

where in the html code i need to add  %0D%0A?
ASKER CERTIFIED SOLUTION
Avatar of Kyle Hamilton
Kyle Hamilton
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Web Development
Web Development

Web development includes all aspects of presenting content on intranets and the Internet, including delivery development, protocols, languages and standards, server software, browser clients, databases and multimedia generation.

78K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo