Advertisement
Guest User

Untitled

a guest
Feb 27th, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.37 KB | None | 0 0
  1. <div id='content'>
  2. <?php
  3.  
  4. function renderform($studentid,$LastName,$FirstName,$mi,$cys,$birthday,$gender,$add,$error)
  5. {
  6. ?>
  7. <html>
  8. <head>
  9. <title>NEW RECORD</title>
  10. </head>
  11. <body>
  12. <?php
  13. if($error!=' ')
  14. {
  15. echo'<div style=padding:4px;border:1px solid red;color:red;''>'
  16. .$error.'</div>';
  17. }
  18. ?>
  19. <form action= "" method="POST">
  20. <input type="hidden" name="id" vlaue="? php echo $id;?/">
  21.  
  22. <table align="center" border="2">
  23. <tr>
  24. <td>
  25. <table align="center">
  26. <tr>
  27. <td>
  28. <strong>STUDENT ID:"</strong><br>
  29. <input type="text" name="studentid" value="<?php echo $studentid;?>"/>
  30. </td>
  31. </tr>
  32. <tr>
  33. <td>
  34.  
  35. <strong>LastName:*"</strong><br>
  36. <input type="text" name="lastName" value="<?php echo $lname;?>"/>
  37. </td>
  38. </tr>
  39. <tr>
  40. <td>
  41. <strong>FirstName:*"</strong><br>
  42. <input type="text" name="firstname" value="<?php echo $fname;?>"/>
  43. </td>
  44. </tr>
  45. <tr>
  46. <td>
  47.  
  48. <strong>MI:*"</strong><br>
  49. <input type="text" name="mi" value="<?php echo $mi;?>"/>
  50. </td>
  51. </tr>
  52. <tr>
  53. <td>
  54. <strong>CYS:*"</strong><br>
  55. <input type="text" name="cys" value="<?php echo $cys;?>"/>
  56. </td>
  57. </tr>
  58. <tr>
  59. <td>
  60. <strong>AGE:*"</strong><br>
  61. <input type="text" name="age" value="<?php echo $age;?>"/>
  62. </td>
  63. </tr>
  64. <tr>
  65. <td>
  66.  
  67. <strong>BIRTHDAY:*"</strong><br>
  68. <input type="text" name="birthday" value="<?php echo $bday;?>"/>
  69. </td>
  70. </tr>
  71. <tr>
  72. <td>
  73.  
  74. <strong>GENDER:"</strong><br>
  75. <input type="text" name="gender" value="<?php echo $gender;?>"/>
  76. </td>
  77. </tr>
  78. <tr>
  79. <td>
  80.  
  81. <strong>ADDRESS:*"</strong><br>
  82. <input type="text" name="address" value="<?php echo $add;?>"/>
  83. </td>
  84. </tr>
  85. <tr>
  86. <td>
  87. </tr>
  88. <tr>
  89. <td colspan="2" align="center">
  90. *REQUIRED
  91. </td>
  92. </tr>
  93. <tr>
  94. <td align="right">
  95. <input type="submit" name="submit" value="SUBMIT" >
  96. </td>
  97. <td align="left">
  98. <input type="reset" name="clear" value="CLEAR" onClick="member.php" >
  99. </td>
  100. </tr>
  101. </table>
  102. </td>
  103. </tr></table>
  104. </form>
  105. </body>
  106. </html>
  107. <?php
  108. }
  109. include("connect.php");
  110.  
  111. if(isset($_POST['submit']))
  112. {
  113. $studentid= mysql_real_escape_string(htmlspecialchars($_POST['studentid']));
  114. $lastName= mysql_real_escape_string(htmlspecialchars($_POST['lname']));
  115. $firstname= mysql_real_escape_string(htmlspecialchars($_POST['fname']));
  116. $mi= mysql_real_escape_string(htmlspecialchars($_POST['mi']));
  117. $age= mysql_real_escape_string(htmlspecialchars($_POST['age']));
  118. $gender= mysql_real_escape_string(htmlspecialchars($_POST['gender']));
  119. $birthday= mysql_real_escape_string(htmlspecialchars($_POST['bday']));
  120. $cys= mysql_real_escape_string(htmlspecialchars($_POST['cys']));
  121. $address= mysql_real_escape_string(htmlspecialchars($_POST['add']));
  122. if($studentid==''||$lastName==''||$firstname==''||$mi==''||$cys==''||$age==''||$birthday==''||$gender==''||$address=='')
  123. {
  124. $error='ERROR: Please fill in all required fields';
  125. renderForm($studentid,$lname,$fname,$mi,$cys,$age,$bday,$gender,$add,$error);
  126. }
  127. else
  128. {
  129. mysql_query("INSERT member SET studentid='$studentid',lastName='$lname',firstname='$fname',mi='$mi',age='$age',gender='
  130. $gender',bdayay='$bday',cys',add='$add''')
  131. or die(mysql_error();
  132. header("Location:member.php'');
  133. }
  134. }
  135. else
  136. {
  137. renderForm('','','','','','','','','','','','');
  138. }
  139. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement