Bootstrap 3 Modals box code php

Test Bootstrap 3 Modals box code php

  1. สร้าง File  index.php  

code #

<!DOCTYPE html>
<html lang=”en”>
<head>
<meta charset=”UTF-8″>
<title>Example of Bootstrap 3 Modals</title>
<link rel=”stylesheet” href=”https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css”>
<link rel=”stylesheet” href=”https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css”>
<script src=”https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js”></script>
<script src=”https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js”></script>
<style>
.container {
padding-left: 15px;
padding-right: 15px;
}
</style>
</head>
<body>
<div class=”container “>
<div class=”jumbotron”><a class=”btn btn-primary pull-right” data-toggle=”modal” href=”#myModal” id=”modellink”>Show Modal</a></div>
<div class=”modal-container”></div>
</div>
</body>
</html>
<script type=”text/javascript”>
$(document).ready(function(){
var url = “modalbox.php”;              //url  สำหรับ link  popup 
jQuery(‘#modellink’).click(function(e) {
$(‘.modal-container’).load(url,function(result){
$(‘#myModal’).modal({show:true});
});
});
});
</script>

2. สร้าง File   modalbox.php

<div id=”myModal” class=”modal fade”>
<div class=”modal-dialog”>
<div class=”modal-content”>
<div class=”modal-header”>
<button type=”button” class=”close” data-dismiss=”modal” aria-hidden=”true”>&times;</button>
<h4 class=”modal-title”>Sample Model Box – Header Area</h4>
</div>
<div class=”modal-body”>
<form>
<div class=”form-group”>
<label for=”recipient-name” class=”control-label”>Recipient:</label>
<input type=”text” class=”form-control” id=”recipient-name”>
</div>
<div class=”form-group”>
<label for=”message-text” class=”control-label”>Message:</label>
<textarea class=”form-control” id=”message-text”></textarea>
</div>
</form>
</div>
<div class=”modal-footer”>
<button type=”button” class=”btn btn-default” data-dismiss=”modal”>Close</button>
<button type=”button” class=”btn btn-primary”>Save</button>
</div>
</div>
</div>
</div>

3.  ทดสอบ  Test RUN  File   index.php