আমি এখানে ২ টি ফাইল এর মাধ্যমে কন্টাক্ট ফর্ম বানানো দেখাবো....
contact.php ফাইলের কোডঃ
এবার ফাইল ২টা হোষ্টিং এ আপলোড করে দিন।
- contact_form.html
- contact.php
1
2
3
4
5
6
7
8
9
10
11
12
| <form method= "POST" action= "contact.php"> Fields marked (*) are required <p>Subject: *<br/> <input type= "text" name= "Subject" required/></p> <p>Your Email:* <br/> <input type= "text" name= "EmailFrom" required/></p> <p>Your Name:* <br/> <input type= "text" name= "Name" required/></p> <p>Your Massage:* <br/> <textarea name= "Massage" required></textarea></p> <p><input type="submit" name= "submit" value= "Send Now"/></p> </form> |
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
| <?php $EmailFrom = $_POST['EmailFrom']; $EmailTo = "your email address here"; $Subject = $_POST['Subject']; $Name = $_POST['Name']; $Telephone = $_POST['Telephone']; $Massage = $_POST['Massage']; /* prepare email body text */ $Body = ""; $Body .= "Name: "; $Body .= $Name; $Body .= "\n"; $Body .= "Massage: "; $Body .= $Massage; $Body .= "\n"; // send email $success = mail($EmailTo, $Subject, $Body, "From: $EmailFrom"); if ($success){ print "Messege sent successfully"; } else{ print "Messege could not sent, please check your mistake"; } ?> |
Any problem comment me...
ReplyDelete