Skip to content

Commit 67de630

Browse files
committed
form working properly
1 parent 7862259 commit 67de630

File tree

2 files changed

+24
-12
lines changed

2 files changed

+24
-12
lines changed

using nodemailer for 2 way authentication/app.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,20 @@ app.get('/',function(req,res){
2424
});
2525

2626

27+
app.post('/send',function(req,res){
28+
const output= `
29+
<h1> You have a new contact request</h1>
30+
<h3>COntact Details</h3>
31+
<ul>
32+
<li> Firstname: ${req.body.firstname}</li>
33+
<li> Lastname: ${req.body.lastname}</li>
34+
<li> email: ${req.body.email}</li>
35+
<li> phone: ${req.body.phone}</li>
36+
</ul>
37+
38+
`;
39+
});
40+
2741
const PORT=process.env.PORT||3000;
2842
app.listen(PORT,()=>{
2943
console.log(`app is live at ${PORT}`);

using nodemailer for 2 way authentication/views/contact.handlebars

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,29 +23,27 @@
2323
</div>
2424
<div class="contact">
2525
<h3>Email Us</h3>
26-
<form>
26+
{{msg}}
27+
<form method="POST" action="send">
2728
<p>
28-
<label>Name</label>
29-
<input type="text" name="name">
29+
<label>Firstname</label>
30+
<input type="text" name="firstname" required>
3031
</p>
3132
<p>
32-
<label>Company</label>
33-
<input type="text" name="company">
33+
<label>Lastname</label>
34+
<input type="text" name="lastname" required>
3435
</p>
3536
<p>
3637
<label>Email Address</label>
37-
<input type="email" name="email">
38+
<input type="email" name="email" required>
3839
</p>
3940
<p>
4041
<label>Phone Number</label>
41-
<input type="text" name="phone">
42+
<input type="number" name="phone" required>
4243
</p>
44+
4345
<p class="full">
44-
<label>Message</label>
45-
<textarea name="message" rows="5"></textarea>
46-
</p>
47-
<p class="full">
48-
<button>Submit</button>
46+
<button type="submit">Submit</button>
4947
</p>
5048
</form>
5149
</div>

0 commit comments

Comments
 (0)