NURU DAWUD

NURU DAWUD

  • 1.3k
  • 349
  • 13.8k

Submit button does nothing?

May 4 2021 10:04 PM
php part(registration.php)
  1. <?php  
  2. session_start();  
  3. include ("db_conn.php");  
  4.   
  5. if(isset($_POST['submit'])){  
  6. function validate($data){  
  7. $data = trim($data);  
  8. $data = stripslashes($data);  
  9. $data = htmlspecialchars($data);  
  10. return $data;  
  11. }  
  12. $fatherName = validate($_POST['fatherName']);  
  13. $firstName = validate($_POST['firstName']);  
  14. $grandFatherName = validate($_POST['grandFatherName']);  
  15. $gender = validate($_POST['gender']);  
  16. $nationality = validate($_POST['nationality']);  
  17. $residence = validate($_POST['residence']);  
  18. $country = validate($_POST['country']);  
  19. $regionOrState = validate($_POST['regionOrState']);  
  20. $city = validate($_POST['city']);  
  21. $email = validate($_POST['email']);  
  22. $phone = validate($_POST['phone']);  
  23. $department = validate($_POST['department']);  
  24. $graYear = validate($_POST['year']);  
  25. $studyLevel = validate($_POST['studyLevel']);  
  26. $ocopation = validate($_POST['ocopation']);  
  27. $comment = validate($_POST['comment']);  
  28. $sql2 = "INSERT INTO mebmbertable(  
  29. fatherName, firstName, grandFatherName, gender, nationality, residence, country, regionOrState, city, email, phone, department, graYear, studyLevel, ocopation, comment )  
  30. VALUES  
  31. ('$fatherName''$firstName''$grandFatherName''$gender','$nationality''$residence''$country''$regionOrState''$city''$email''$phone''$department''$graYear''$studyLevel''$ocopation''$comment')";  
  32. if (!mysqli_query($conn$sql2)) {  
  33. echo " Your account has been created successfully. Please login... ";  
  34. }else {  
  35. header("error=unknown error occurred");  
  36. }  
  37. }  
  38. ?>  
HTML PART(registrationForm.php)
  1. <?php  
  2. session_start();  
  3. include ("db_conn.php");  
  4. ?>  
  5.   
  6. <!DOCTYPE html>  
  7. <!-- Designined by CodingLab - youtube.com/codinglabyt -->  
  8. <html lang="en" dir="ltr">  
  9. <head>  
  10. <meta charset="UTF-8">  
  11. <title> Membership Registration </title>  
  12.   
  13. <link rel="stylesheet" href="style1.css">  
  14. <link rel="stylesheet" href="style.css">  
  15. <script src="alert.js"></script>  
  16. <meta name="viewport" content="width=device-width, initial-scale=1.0">  
  17. </head>  
  18. <body>  
  19. <div class="container">  
  20. <center>  
  21. <h1 class="h"> X University Registrar and Alumni Directorate </h1>  
  22. <h2 class="h">Membership Application Form</h2>  
  23. <h3 class="h">Membership is open to all graduates of Wollo University  
  24. </center>  
  25. <div class="content">  
  26. <form action="registration.php" method="POST">  
  27. <div class="title">1) Personal Information </div>  
  28. <div class="user-details">  
  29. <div class="input-box">  
  30. <span class="details">Father Name</span>  
  31. <input type="text" name="fatherName" placeholder="Father Name" required >  
  32. </div>  
  33. <div class="input-box">  
  34. <span class="details">Name</span>  
  35. <input type="text" name="firstName" placeholder="Name" required>  
  36. </div>  
  37. <div class="input-box">  
  38. <span class="details">Grand Father Name</span>  
  39. <input type="text" name="grandFatherName" placeholder="Grand Father Name" required>  
  40. </div>  
  41. <div class="input-box">  
  42. <span class="details">Nationality</span>  
  43. <input type="text" name="nationality" placeholder="Nationality" required>  
  44. </div>  
  45. <div class="input-box">  
  46. <span class="details">Residence</span>  
  47. <input type="text" name="residence" placeholder="Residence" required>  
  48. </div>  
  49. <div class="input-box">  
  50. <span class="details">Country</span>  
  51. <input type="text" name="country" placeholder="Country" required>  
  52. </div>  
  53. <div class="input-box">  
  54. <span class="details">Region/State</span>  
  55. <input type="text" name="regionOrState" placeholder="Region/State" required>  
  56. </div>  
  57. <div class="input-box">  
  58. <span class="details">City</span>  
  59. <input type="text" name="city" placeholder="City" required>  
  60. </div>  
  61. <div class="input-box">  
  62. <span class="details">Email</span>  
  63. <input type="email" name="email" placeholder="Email" required>  
  64.   
  65. </div>  
  66. <div class="input-box">  
  67. <span class="details">Phone</span>  
  68. <input type="tel" name="phone" placeholder="Phone" required>  
  69. </div>  
  70. <div class="input-box">  
  71. <span class="details">Gender</span>  
  72. <select name="gender" id="gender" class="select">  
  73. <option value="">...</option>  
  74. <option value="Male">Male</option>  
  75. <option value="Female">Female</option>  
  76. </select>  
  77. </div>  
  78. </div>  
  79. <div class="title">2) Education </div>  
  80. <div class="user-details">  
  81. <div class="input-box">  
  82. <span class="details">Department</span>  
  83. <input type="text" name="department" placeholder="Department" required>  
  84. </div>  
  85. <div class="input-box">  
  86. <span class="details">Year of Gratuation</span>  
  87. <input type="year" name="year" placeholder="Year of Gratuation" required>  
  88. </div>  
  89. <div class="input-box">  
  90. <span class="details">Study Level</span>  
  91. <select name="studyLevel" id="sl" class="select">  
  92. <option value="">...</option>  
  93. <option value="Diploma">Diploma</option>  
  94. <option value="Advanced Deploma">Advanced Deploma</option>  
  95. <option value="BA/BSC">BA</option>  
  96. <option value="BA/BSC">BSC</option>  
  97. <option value="MA/MSC">MA</option>  
  98. <option value="BA/BSC">MSC</option>  
  99. <option value="PhD">PhD</option>  
  100. <option value="Speciality">Speciality</option>  
  101. <option value="Sub-Speciality">Sub-Speciality</option>  
  102. </select>  
  103. </div>  
  104. <div class="input-box">  
  105. <span class="details">Ocopation</span>  
  106. <select name="ocopation" id="sl" class="select">  
  107. <option value="">...</option>  
  108. <option value="Gevernment">Gevernment</option>  
  109. <option value="Private">Private</option>  
  110. <option value="NGO">NGO</option>  
  111. <option value="Job Seeker">Job Seeker</option>  
  112. <option value="Other">Other</option>  
  113. </select>  
  114. </div>  
  115. <div class="input-box">  
  116. <span class="details">Comment</span>  
  117. <textarea class = "textarea" name="comment" placeholder=" Enter your comment here..."></textarea>  
  118. </div>  
  119. <div class="input-box">  
  120. <br><br>  
  121. <img src="img/Membership.gif" width="70%" height="50%" align="right" alt="Membership" >  
  122. </div>  
  123. </div>  
  124. <div class="button">  
  125. <button type="submit" value="Save"> Save</button>  
  126. </div>  
  127. <div class="button">  
  128. <input type="reset" value="Reset">  
  129. </div>  
  130. <div>  
  131. <h1 class="a"><a href="logout.php" >Logout</a></h1>  
  132. </div>  
  133. </form>  
  134. <div class="thankyou">  
  135. <center> <h3>Hello, <?php echo $_SESSION['name']; ?></h3>  
  136. <p class="p">Thank you for filling this form<br>  
  137. X University Registrar and Alumni Directorate  
  138. </p> </center>  
  139. </div>  
  140. </div>  
  141. </div>  
  142. </body>  
  143. </html>  

Answers (1)