-
Notifications
You must be signed in to change notification settings - Fork 0
/
29. Contact form.php
41 lines (36 loc) · 800 Bytes
/
29. Contact form.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* 29. Contact form using Php */
contactform.php
<html>
<head>
</head>
<body>
<h4>Contact Form</h4>
<form method="post "action="sendmail
.php">
Name : <input type="text"name="uname"><br>
Mobile No. : <input type="text" name="mobile"><br>
Email id : <input type="text" name="email"><br>
Message : <textarea name="message">
</textarea><br>
<input type="submit" value="Submit">
</form>
</body>
</html>
sendmail.php
<?php
$uname = $_POST['uname'];
$mobile = $_POST['mobile'];
$email = $_POST['email'];
$message = $_POST['message'];
$to = "[email protected]";
$subject = "Contact";
$message = $message."\n Name: ".$uname."\n Mobile: ".$mobile."\n Email: $email;
if(mail($to,$subject,$message))
{
echo "Thank you for contacting us";
}
else
{
echo "Try again";
}
?>