Guest User

Untitled

a guest
Nov 5th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.81 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title> form page</title>
  4. <script language="javascript">
  5. function a()
  6. {
  7. document.f1.t7.value="WELCOME"+" "+ document.f1.t1.value+" "+document.f1.t2.value
  8.  
  9. }
  10. function b()
  11. {
  12.  
  13. result="Hello"+document.f1.t1.value+" "+"welcome to our website."+"You are a "
  14.  
  15. if(document.f1.r1[0].selected)
  16. {
  17. result=result+"male"
  18. }
  19. if(document.f1.r1[1].selected)
  20. {
  21. result=result+"female"
  22. }
  23. alert(result)
  24. }
  25.  
  26. function check()
  27. {
  28. if(document.f1.t5.value==document.f1.t6.value)
  29. {
  30. alert("valid password")
  31. }
  32. else{
  33. alert("Invalid password.The passwords don't match.Please re check ")
  34. }
  35. }
  36.  
  37. </script>
  38. <?php
  39. function details()
  40. {
  41. $username = "root";
  42. $password = "";
  43. $dob=$_POST['year']."-".$_POST['month']."-".$_POST['date'];
  44. try{
  45. $conn = new PDO('mysql:host=localhost;dbname=form',$username,$password);
  46. $stm="INSERT INTO details(name,gender,DOB,email,password) VALUES(:tname,:tgender,:tdob,:temail,:tpassword);" ;
  47. $sql= $conn->prepare($stm);
  48. $inst=$sql->execute(array(
  49. ":tname"=>$_POST['name'],
  50. ":tgender"=>$_POST['gender'],
  51. ":tdob"=>$dob,
  52. ":temail"=>$_POST['email'],
  53. ":tpassword"=>$_POST['password']));
  54. echo "New records created successfully";
  55. }
  56. catch(PDOException $e)
  57. {
  58. echo $e->getMessage();
  59. }
  60. }
  61.  
  62. if(isset($_POST['btnSubmit']))
  63. {
  64. details();
  65. }
  66. ?>
  67.  
  68.  
  69. </head>
  70. <body >
  71. <form name=f1 method="post" action="<?php echo $_POST["PHP SELF"];?>">
  72. <h1><font color= "red" size="70"> <center>&nbsp&nbsp&nbsp&nbsp&nbspREGISTERATION FORM </center></font></h1>
  73.  
  74. <div class="color">
  75. <table border=0 ><center>
  76. <tr>
  77. <td> <center> FIRST NAME:<input type= text name=t1 select="ENTER YOUR FIRST NAME" maxlength=20></center></tr>
  78. <tr>
  79. <td><center> LAST NAME:<input type= text name=t2 select="ENTER YOUR LAST NAME" maxlength=20 onBlur="a()"></center>
  80. <br>
  81. <center><input type="text" name=name ></center>
  82.  
  83. </tr>
  84. <tr>
  85. <td><center> <input type=radio name=gender value="male" >MALE</center>
  86. <tr>
  87. <td><center> <input type=radio name=gender value="female" >FEMALE</center> </tr>
  88. </tr>
  89. <tr>
  90. <td> <center> Date Of Birth<select name="date" onFocus="b()">
  91. <option value = 1>01
  92. <option value = 2>02
  93. <option value =3>03
  94. <option value =4>04
  95. <option value =5>05
  96. <option value =6>06
  97. <option value =7>07
  98. <option value =8>08
  99. <option value =9>09
  100. <option value =10>10
  101. <option value =11>11
  102. <option value =12>12
  103. <option value =13>13
  104. <option value =14>14
  105. <option value =15>15
  106. <option value =16>16
  107. <option value =17>17
  108. <option value =18>18
  109. <option value =19>19
  110. <option value =20>20
  111. <option value =21>21
  112. <option value =22>22
  113. <option value =23>23
  114. <option value =24>24
  115. <option value =25>25
  116. <option value =26>26
  117. <option value =27>27
  118. <option value =28>28
  119. <option value =29>29
  120. <option value =30>30
  121. <option value =31>31
  122. </center>
  123. </tr>
  124. <tr>
  125. <td><center>
  126. Month<select name="month ">
  127. <option value =1>January
  128. <option value =2>February
  129. <option value =3>March
  130. <option value =4>April
  131. <option value =5>May
  132. <option value =6>June
  133. <option value =7>July
  134. <option value =8>August
  135. <option value =9>September
  136. <option value =10>October
  137. <option value =11>November
  138. <option value =12>December
  139. </select></center>
  140. </tr>
  141. <tr>
  142. <td><center>
  143. Year<input type=text name="year" size ="5" >
  144. </center>
  145. </tr>
  146. <tr>
  147. <td><center> EMAIL:<input type= text name=email select="ENTER YOUR EMAIL"></center>
  148.  
  149. </tr>
  150. <br>
  151. <br>
  152. <tr><td><center> USERNAME: <input type=text name=username select="ENTER USERNAME" maxlength=20></center></tr>
  153. <td> <center> PASSWORD: <input type=password name=password select="PASSWORD" maxlength=20></center></tr>
  154. <td> <center> CONFIRM PASSWORD: <input type=password name=t6 select="CONFIRM PASSWORD" maxlength=20 onBlur="check()"></center></tr>
  155.  
  156.  
  157. <tr>
  158. <td>
  159. By clicking register, you accept to our rules and regulations:
  160. <input type="SUBMIT"value="REGISTER" >
  161. <input type="RESET" value="OOps!! want to reset?">
  162. </tr>
  163. </table></center>
  164. </div>
  165.  
  166.  
  167.  
  168.  
  169. </body>
  170. </html>
Add Comment
Please, Sign In to add comment