Please Help Me Fix My PHP Register Form

Reply

Join Date: Nov 2009
Posts: 1
Reputation: Chosen13 is an unknown quantity at this point 
Solved Threads: 0
Chosen13 Chosen13 is offline Offline
Newbie Poster

Please Help Me Fix My PHP Register Form

 
-3
  #1
30 Days Ago
  1. <?php
  2. if(isset($_POST['register']))
  3. {
  4. $username = $_POST["username"];
  5. $password = $_POST["password"];
  6. $email = $_POST["email"];
  7. $conf_pass = $_POST["confirm"];
  8. $error = false;
  9.  
  10. $connect = mysql_connect("localhost", "stickmi1_data", "electricCompany");
  11. $database = mysql_select_db("account", $connect);
  12.  
  13. $usernameCheck = mysql_query("SELECT username FROM users WHERE username = '$username'");
  14.  
  15. // Registration Form Validation Script
  16.  
  17. if(!$username || !$password || !$email || !$conf_pass)
  18. {
  19. $error = true;
  20. $errorMessage = "Please fill in any missing fields before continuing!";
  21. }
  22. else if($password != $conf_pass);
  23. {
  24. $error = true;
  25. $errorMessage = "Your password and confirmation password don't match!";
  26. }
  27. if($usernameCheck > 0)
  28. {
  29. $error = true;
  30. $errorMessage = "The requested username is already in use, try another!";
  31. }
  32. if($error == false)
  33. {
  34. $password = md5($password);
  35. mysql_query("INSERT INTO users(username, password, email) VALUES($username, $password, $email)",$connect);
  36. }
  37. }
  38. ?>
  39. <form name="register_form" method="post">
  40. <table>
  41. <tr>
  42. <td>Username: </td>
  43. <td><input type="text" name="username" /></td>
  44. </tr>
  45. <tr>
  46. <td>Password: </td>
  47. <td><input type="password" name="password" /></td>
  48. </tr>
  49. <tr>
  50. <td>Confirm Pass: </td>
  51. <td><input type="password" name="conf_pass" /></td>
  52. </tr>
  53. <tr>
  54. <td>Email: </td>
  55. <td><input type="text" name="email" /></td>
  56. </tr>
  57. <tr>
  58. <td><input type="submit" name="register" value="Register" /></td>
  59. </tr>
  60. </table>
  61. </form>
Last edited by Ezzaral; 30 Days Ago at 4:54 pm. Reason: Added code tags. Please use them to format any code that you post.
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 524
Reputation: Will Gresham is on a distinguished road 
Solved Threads: 86
Sponsor
Will Gresham's Avatar
Will Gresham Will Gresham is offline Offline
Posting Pro
 
-1
  #2
30 Days Ago
1. Please use [code][/code] tags to post your code.
2. Tell us what the problem is, I for one would not want to read your code and then guess at the problem.
AJAX is not a programming language, scripting language or any other sort of language.
It is acheived by using JavaScript http functions.
So, AJAX = JavaScript.
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC