Topic: Form Functionality
timit2thelimit pro asked 9 years ago
mark petersen answered 9 years ago
Michal Szymanski staff pro premium priority answered 9 years ago
timit2thelimit pro answered 9 years ago
<!-- Modal Contact -->
<div class="modal fade modal-ext" id="modal-contact" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<!--Content-->
<div class="modal-content">
<!--Header-->
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title" id="myModalLabel">Write to me</h4>
</div>
<!--Body-->
<div class="modal-body">
<p>What's on your mind?</p>
<br>
<div class="md-form">
<i class="fa fa-user prefix"></i>
<input type="text" id="form22" class="form-control">
<label for="form42">Your name</label>
</div>
<div class="md-form">
<i class="fa fa-envelope prefix"></i>
<input type="text" id="form32" class="form-control">
<label for="form34">Your email</label>
</div>
<div class="md-form">
<i class="fa fa-tag prefix"></i>
<input type="text" id="form32" class="form-control">
<label for="form34">Subject</label>
</div>
<div class="md-form">
<i class="fa fa-pencil prefix"></i>
<textarea type="text" id="form8" class="md-textarea"></textarea>
<label for="form8">Message</label>
</div>
<div class="text-xs-center">
<button type="button" class="btn btn-stc">Submit</button>
</div>
</div>
<!--Footer-->
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
<!--/.Content-->
This is just the basic code. I'm unsure how to use this to actually receive email from site visitors as this isn't truly a form as HTML sees it.
I hope this sheds a little light on my issue. Thanks in advance for your time. Dawid Adach pro answered 8 years ago
<?php
if(isset($_POST['submit'])){
$to = "email@example.com"; // this is your Email address
$from = $_POST['email']; // this is the sender's Email address
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$subject = "Form submission";
$subject2 = "Copy of your form submission";
$message = $first_name . " " . $last_name . " wrote the following:" . "nn" . $_POST['message'];
$message2 = "Here is a copy of your message " . $first_name . "nn" . $_POST['message'];
$headers = "From:" . $from;
$headers2 = "From:" . $to;
mail($to,$subject,$message,$headers);
mail($from,$subject2,$message2,$headers2); // sends a copy of the message to the sender
echo "Mail Sent. Thank you " . $first_name . ", we will contact you shortly.";
// You can also use header('Location: thank_you.php'); to redirect to another page.
}
?>
<!DOCTYPE html>
<head>
<title>Form submission</title>
</head>
<body>
<form action="" method="post">
First Name: <input type="text" name="first_name"><br>
Last Name: <input type="text" name="last_name"><br>
Email: <input type="text" name="email"><br>
Message:<br><textarea rows="5" name="message" cols="30"></textarea><br>
<input type="submit" name="submit" value="Submit">
</form>
</body>
</html>
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- User: Pro
- Premium support: No
- Technology: General Bootstrap questions
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: No
- Provided link: No