Guest User

Untitled

a guest
Dec 12th, 2017
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. <?php
  2.  
  3. $user = 'root';//mysqli_connect('127.0.0.1','root','');
  4. $pass = '';
  5. $database = 'tennis';
  6. $db = new mysqli('localhost', $user, $pass, $database) or die("Unable to connect");
  7. echo "Great work";
  8.  
  9. // if(!$user)
  10. // {
  11. // echo 'Not Connected To Server';
  12. // }
  13. // if (!mysqli_select_db ($user,'tennis'))
  14. // {
  15. // echo 'Database Not Selected';
  16. // }
  17. echo '<pre>';
  18. var_dump($_POST);
  19. echo '</pre>';
  20. if(isset($_POST['PLAYER_NAME'])){
  21. $PLAYER_NAME = $_POST['PLAYER_NAME'];
  22. } else {
  23. echo 'Need to fill out name';
  24. }
  25.  
  26. //var_dump($_POST);
  27. if(isset($_POST['Age'])){
  28. $Age = $_POST['Age'];
  29. } else {
  30. $Age = '';
  31. echo 'Need to fill out name';
  32. }
  33.  
  34. //var_dump($_POST);
  35. if(isset($_POST['Address'])){
  36. $Address = $_POST['Address'];
  37. } else {
  38. echo 'Need to fill out name';
  39. }
  40.  
  41. //var_dump($_POST);
  42. if(isset($_POST['Phone'])){
  43. $Phone = $_POST['Phone'];
  44. } else {
  45. echo 'Need to fill out name';
  46. }
  47. //var_dump($_POST);
  48. if(isset($_POST['Hours'])){
  49. $Hours = $_POST['Hours'];
  50. } else {
  51. echo 'Need to fill out name';
  52. }
  53.  
  54. //var_dump($_POST);
  55. if(isset($_POST['Price'])){
  56. $Price = $_POST['Price'];
  57. } else {
  58. echo 'Need to fill out name';
  59. }
  60.  
  61. //var_dump($_POST);
  62. if(isset($_POST['Facility'])){
  63. $Facility = $_POST['Facility'];
  64. } else {
  65. echo 'Need to fill out name';
  66. }
  67.  
  68. //var_dump($_POST);
  69. if(isset($_POST['Instructor'])){
  70. $Instructor = $_POST['Instructor'];
  71. } else {
  72. echo 'Need to fill out name';
  73. }
  74.  
  75.  
  76. $sql = "INSERT INTO player (PLAYER_NAME,PLAYER_AGE,ADDRESS,PHONE,HOURS_WEEK,PRICE,FAC_NAME,INSTR_NUM) VALUES ('$PLAYER_NAME','$Age','$Address','$Phone','$Hours','$Price','$Facility','$Instructor')";
  77.  
  78.  
  79.  
  80. $query = mysqli_query($db,$sql);
  81.  
  82. echo '<pre>';
  83. var_dump($sql);
  84. echo '</pre>';
  85. /*
  86. if (!mysqli_query($con,$sql))
  87. {
  88. echo 'Not Inserted';
  89. }
  90.  
  91. else
  92. {
  93. echo 'Inserted';
  94. }
  95.  
  96. header("refresh:2; url=index.html");
  97. */
  98.  
  99. include 'table.html'
  100. ?>
Add Comment
Please, Sign In to add comment