Search the Community
Showing results for tags 'registration form'.
-
I have the following code for a very simple registration form handler - //require('../../config/config.php'); require('reg_functions.php'); //assign clean form variables $firstname = clean_names($_POST['firstname']); $lastname = clean_names($_POST['lastname']); $username = clean_names($_POST['username']); $email = clean_email($_POST['email']); $email2 = clean_email($_POST['email2']); $password = clean_password($_POST['password']); $password2 = clean_password($_POST['password2']); $date = date("Y-m-d"); if(isset($_POST['register_button'])) { //validate & confirm emails match if($email == $email2) { if(filter_var($email, FILTER_VALIDATE_EMAIL)) { $email = filter_var($email, FILTER_VALIDATE_EMAIL); // I THINK I COULD DEF MAKE THIS EMAIL CHECK CLEANER - WORK ON THAT LATER //check if email exists in system already $email_check = mysqli_query($conn, "SELECT email FROM users WHERE email='$email'"); //number of rows returned with the email (this should be 0 to proceed) $number_rows = mysqli_num_rows($email_check); if($number_rows > 0) { echo "Email already in use <br>"; } else { echo "email is correct <br>"; } } else { echo "Invalid email format <br>"; } } else { echo "Emails don't match <br>"; } echo "First Name: " . $firstname . "<br>"; echo "Last Name: " . $lastname . "<br>"; echo "Username: " . $username . "<br>"; echo "Number of Rows: " . $number_rows . "<br>"; } the code that starts with the mysqli_query() function to check for matching emails is where it fails (white screen). I figured it may be because the $conn variable wasn't being associated with the $conn variable in the config.php file. So I added the require config.php at the top. Now it only works if both are commented out. So in reality this could be 2 issues and I struggled with how not to ask too many questions in one post though they may be the same issue. I'm really new to php. Can someone explain the mechanics of whats going on (or not going on). to recap, this is the code that caused the white screen initially - // I THINK I COULD DEF MAKE THIS EMAIL CHECK CLEANER - WORK ON THAT LATER //check if email exists in system already $email_check = mysqli_query($conn, "SELECT email FROM users WHERE email='$email'"); //number of rows returned with the email (this should be 0 to proceed) $number_rows = mysqli_num_rows($email_check); if($number_rows > 0) { echo "Email already in use <br>"; } else { echo "email is correct <br>"; } and I realized it had no association to the $conn variable in the config.php file so I added the require config.php line at the top. This above code is obviously still not working and if I comment it out, the require config.php line still causes a white screen. This is my config file - ob_start(); session_start(); $timezone = date_default_timezone_set("America/xxxxxxxx"); $db_host = "localhost"; $db_user = "root"; $db_pass = ""; $db_name = "qcic"; $conn = mysqli_connect( $db_host, $db_user, $db_pass, $db_name ); if( $conn->connect_errno) { printf( "Connect Failed: %s\n", $conn->connect_error); exit(); } else { echo "Connected to database"; } ob_end_flush(); and I get the "Connected to database" echo so I have no idea what the problem is. Anyone with some time and more experience that can explain some of these things? thanks
-
Hi, I dont know if this is a wrong category to post. I have a registration form in my website. I need a overlay popup after the sucessfull registration process. Can someone help me. Thanks in advance. Regards..
-
- registration form
- popup
-
(and 2 more)
Tagged with:
-
Hi Everyone, I have a couple of questions to ask as I am a PhP newbie. Firstly I am working on a website which will have some content inside it which I only want members to view: as far as I am aware I need to write:- i) Registration script ii) Log-in script which will both work with a MySQL database which will store the members login details. (So far so good I think!!!!) is there access to forms that have already been written?? and have I got the procedure above correct for a membership style website... is there anything else I should be aware of ?? basic questions I know but I really am new to this...
- 5 replies
-
- membership forms
- login form
-
(and 2 more)
Tagged with: