-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpopup.txt
71 lines (60 loc) · 2.35 KB
/
popup.txt
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<div class="modal fade" id="modalContactForm" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header text-center">
<h2 class="modal-title font-weight-bold">Bootstrap Modal Form</h2>
</div>
<div class="modal-body mx-3">
<div class="md-form mb-5">
<i class="fa fa-user prefix grey-text"></i>
<label data-error="wrong" data-success="right" for="fname">Full Name:</label>
<input type="text" id="fname" class="form-control validate">
</div>
<div class="md-form mb-5">
<i class="fa fa-envelope prefix grey-text"></i>
<label data-error="wrong" data-success="right" for="email">e-Mail:</label>
<input type="email" id="email" class="form-control validate">
</div>
</div>
<div class="modal-footer d-flex justify-content-center">
<button id="send" class="btn btn-info">Submit <i class="fa fa-paper-plane-o ml-1"></i></button>
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
(Launch the modal box
<a href="" class="btn btn-success" data-toggle="modal" data-target="#modalContactForm">Launch Modal Contact Form</a>)
(To display user submitted data
<div class="modal-body">
<div id="result"></div>
</div>)
(Javascript
<script type='text/javascript'>
$(document).ready(function(){
$('#modalContactForm').on('click', '.btn-info', function(e){
var vfname = $('#fname').val();
var vemail = $('#email').val();
$.post("result.php",
{
fname:vfname,
email:vemail,
},
function(response,status){
$("#result").html(response);
});
$('#modalContactForm').modal('hide');
});
});
</script>
)
PHP
<?php
if($_POST["fname"])
{
echo "<h4>Thank you for submission!<h4>";
echo "<br>Your Name: <b>".$_POST["fname"]."</b>";
echo "<br>Your e-mail: <b>".$_POST["email"]."</b>";
}
?>