Perad Posted August 14, 2007 Share Posted August 14, 2007 Its been a while since I have used classes and I am obviously doing something wrong. When I submit the form nothing is happening. Could someone tell me what I need to do to actually make something happen. Head of register.php <?php include 'functions.php'; if ($_POST['register']) { $register = new Register; $register->SQL($_POST['user'], $_POST['pass'], $POST['confpass'], $POST_['email']); } ?> register.php content <?php if ($register->error || $register->message) { print $register->error; print $register->message; } else { ?> <form name="register" action="register.php" method="post"> Username:<input type="text" name="user" class="login" value="" maxlength="20"> Password:<input type="text" name="pass" class="login" value="" maxlength="20"> Confirm Password:<input type="text" name="confpass" class="login" value="" maxlength="20"> E-Mail:<input type="text" name="email" class="login" value="" maxlength="40"> <input type="submit" value="Register" name="Register" /> </form> <?php } ?> functions.php <?php class Register { public $message; public $error; public function SQL($user, $pass, $confpass, $email) { echo "ha"; $clean_user = $this->cleanString($user); $clean_pass = $this->cleanString($pass); $clean_confpass = $this->cleanString($confpass); $clean_email = $this->cleanString($email); if ($clean_pass == $clean_confpass) { $sql = "INSERT INTO members (username, password, email, join) VALUES ('$clean_user', '$clean_pass', '$clean_email', NOW())"; $result = mysql_query($sql) or die(mysql_error()); if ($result) { $this->message = "Congrats, you have successfully registered"; } else { $this->error = "There has been an error, please try again later"; } } else { $this->error = "Error: Your passwords do not match"; } } private function cleanString($string, $length) { $string = trim($string); $string = stripslashes($string); $string = strip_tags($string); $string = substr($string, 0, $length); return $string; } } Any help with this is every much appreciated Link to comment https://forums.phpfreaks.com/topic/64832-easy-class-question/ Share on other sites More sharing options...
HuggieBear Posted August 14, 2007 Share Posted August 14, 2007 PHP is case sensitive... Try if ($_POST['Register']) { Regards Huggie Link to comment https://forums.phpfreaks.com/topic/64832-easy-class-question/#findComment-323494 Share on other sites More sharing options...
Aureole Posted August 14, 2007 Share Posted August 14, 2007 Note: I find it's best to always user lower-case then you don't get problems like this. Link to comment https://forums.phpfreaks.com/topic/64832-easy-class-question/#findComment-323498 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.