Latest News

Thursday, January 5, 2017

Basic Dynamic Input Using jQuery/MySQLi Download PHP Source Codes

Submitted by: 
Language: 
Visitors have accessed this post 107 times.

                   Download PHP Source Code Below

The Simple Dynamic Input was built using jQuery/PHP. I used Bootstrap as a front-end framework for the design. This simple application will show you how dynamic input can submit multiple data to MySQL database server.

This is the sample code for the HTML
  1. <div class = "row">
  2. <div class = "col-md-3">
  3. </div>
  4. <div class = "col-md-1" style = "margin-left:10px;" >
  5. <button class = "btn btn-success" id = "add"><span class = "glyphicon glyphicon-plus"></span> Add new Entry</button>
  6. <br />
  7. <br />
  8. </div>
  9. <form method = "POST" action = "save_data.php">
  10. <button class = "btn btn-primary" name = "submit" ><span class = "glyphicon glyphicon-save"></span> Submit</button>
  11. <div style = "margin-left:30px;" id = "input" class = "col-md-3">
  12. <div class = "well">
  13. <div class = "form-group">
  14. <label>Firstname</label>
  15. <input class = "form-control" type = "text" name = "firstname[]"/>
  16. </div>
  17. <div class = "form-group">
  18. <label>Lastname</label>
  19. <input class = "form-control" type = "text" name = "lastname[]"/>
  20. </div>
  21. </div>
  22. </div>
  23. </form>
  24. </div>
  25. </body>
  26. <script src = "js/jquery.js"></script>
  27. <script type = "text/javascript">
  28. $(document).ready(function(){
  29. $('#add').click(function(){
  30. $input = $('<div class = "well">'
  31. + '<br />'
  32. + '<div class = "form-group">'
  33. + '<label>Firstname</label>'
  34. + '<input class = "form-control" type = "text" name = "firstname[]" required = "required"/>'
  35. + '</div>'
  36. + '<div class = "form-group">'
  37. + '<label>Lastname</label>'
  38. + '<input class = "form-control" type = "text" name = "lastname[]" required = "required"/>'
  39. + '</div>');
  40. $input.fadeIn(1000).appendTo('#input');
  41. });
  42. });
  43. </script>
I hope that this kind of Source Code can be used to your projects and future project. For more tutorials and updates just visit this site. Enjoy Coding!

PHP CODES

No comments:

Post a Comment

Recent Post