Guest User

Untitled

a guest
Sep 16th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.50 KB | None | 0 0
  1. Php Form is not submitting the values
  2. <?php
  3. if ($username && $userid) {
  4. echo "you are already logged in as $dbuser.<a href='w-post.php'> Click here to go to Post area</a>";
  5. }
  6.  
  7. else {
  8. $form = "<form method=post action=123.php autocomplete=off enctype=multipart/form-data>
  9.  
  10. <table width=759 border=1>
  11. <tr>
  12. <td width=749>
  13. <table width=756 border=1>
  14. <tr>
  15. <td colspan=3 bgcolor=#d9d9d9>
  16. <div align=center class=style1><font color=#003366>PERSONAL INFORMATION</font></div>
  17. </td>
  18. </tr>
  19. <tr>
  20. <td width=196>
  21. <div class=label-text>Email Address</div>
  22. </td>
  23. <td width=297>
  24. <div class=accountboxes><input type=text class=accounttextboxes id=txtemail name=txtemail
  25. size=50/>
  26. </div>
  27. </td>
  28. <td width=241>&nbsp;</td>
  29. </tr>
  30. <tr>
  31. <td width=196>
  32. <div class=label-text>Password</div>
  33. </td>
  34. <td width=297>
  35. <div class=accountboxes><input type=password class=accounttextboxes id=txtpass name=txtpass
  36. size=50/>
  37. </div>
  38. </td>
  39. <td width=241>&nbsp;</td>
  40. </tr>
  41. <tr>
  42. <td width=196></td>
  43. <td width=297><input name=submit type=submit id=submit value=submit/>
  44.  
  45. <td width=241>&nbsp;</td>
  46. </tr>
  47. </table>
  48. </td>
  49. </tr>
  50. </table>
  51. </td>
  52. </tr>
  53. </table>
  54. </form>";
  55.  
  56. if (isset($_POST['submit'])) {
  57. $user = $_POST['txtemail'];
  58. $pass = $_POST['txtpass'];
  59. if ($user) {
  60. if ($password) {
  61. $password = md5($pass);
  62. //echo $epassword;
  63. $query = mysql_query("SELECT * from users where email='$user'");
  64. $numrows = mysql_num_rows($query);
  65. if ($numrows == 1) {
  66. $row = mysql_fetch_assoc($query);
  67. $id = $row['id'];
  68. $dbuser = $row['name'];
  69. $dbpass = $row['password'];
  70. $activate = $row['activation'];
  71. if ($password == $dbpass) {
  72. if ($activate == '1') {
  73. $_SESSION['name'] = $dbuser;
  74. $_SESSION['id'] = $id;
  75. $_SESSION['email'] = $email;
  76. header('location:forms.php');
  77. exit();
  78. }
  79. else {
  80. $error_account = 'Your Account is not activated yet';
  81. }
  82. echo $form;
  83. }
  84. else {
  85. $error_pass = 'You entered an incorrect password';
  86. }
  87. echo $form;
  88. }
  89.  
  90. else {
  91. $error_email = 'Email Address not found';
  92. echo $form;
  93. }
  94.  
  95. }
  96.  
  97. else {
  98. $enter_pass = 'Enter your password';
  99. echo $form;
  100. }
  101.  
  102. }
  103. else {
  104. $enter_email = 'Enter email address';
  105. echo $form;
  106. }
  107.  
  108. }
  109.  
  110. else {
  111. echo $form;
  112. }
  113.  
  114. }
  115. ?>
  116.  
  117. if (isset($_POST['submit'])) {
  118. $error = 0;
  119. $errorMessages = array();
  120. $user = $_POST['txtemail'];
  121. $pass = $_POST['txtpass'];
  122. if (!$user) {
  123. $errors++;
  124. $errorMessages[] = "Please enter your email address";
  125. }
  126. ...//rest of the form check
  127. if($errors == 0) {
  128. //do what you want with the data
  129. }
  130. }
  131.  
  132. $form = <<<EOD
  133. <form method="post" action="123.php" autocomplete="off" enctype="multipart/form-data">
  134. <table width="759" border="1">
  135. <tr>
  136.  
  137. <!-- Rest of HTML code -->
  138.  
  139. EOD;
Add Comment
Please, Sign In to add comment