Search the Community
Showing results for tags 'database record'.
-
Hello guys. I have a problem with signup form record in database. My code works good but only firstname input doesnt send it to database. Other all information shown up in database. Do you have any idea why it is not working? <?php // index.php session_start(); require_once 'functions.php'; $userfirstname = $lastname = $email = $remember = $error = $username = $pass = $password1 = $password2 = $user = $birthday = $bdd = $bdm = $bdy = ""; $imgavatar = 'img/default_user_avatar.png'; $userstr = '(Guest)'; if (isset($_SESSION['user'])) { $user = $_SESSION['user']; $loggedin = TRUE; $userstr = " ($user)"; } else $loggedin = FALSE; if ($loggedin){ //redirect for profile page } if(isset($_POST['username'])&&($_POST['first']) && ($_POST['lastname']) && ($_POST['email'])){ $username = sanitizeString($_POST['username']); $password1 = sanitizeString($_POST['p']); $password2 = sanitizeString($_POST['p2']); $email = sanitizeString($_POST['email']); $userfirstname = sanitizeString($_POST['first']); $lastname = sanitizeString($_POST['lastname']); $bdd = sanitizeString($_POST['day']); $bdm = sanitizeString($_POST['month']); $bdy = sanitizeString($_POST['year']); $birthday = $bdd." / ".$bdm." / ".$bdy; if ( ($username == "") || ($email =="") || ($password1 =="") || ($password2 =="") || ($userfirstname = "") || ($lastname == "")) { $error = "You didn't give us enough information for Signup"; } else { $result = queryMySQL("SELECT * FROM Members WHERE username='$username'"); if($result->num_rows) { $error ="This Username is already exists"; } else { queryMysql("INSERT INTO Members VALUES( '$userfirstname','$lastname','$email','$username','$password1','$birthday')"); die("<h4>Account created</h4>Please Log in. Your first name is $userfirstname<br><br>"); } } } echo <<<_END <DOCTYPE html> <html> <head> <title>World. Your New World</title> <link rel='stylesheet' href='styles.css' type='text/css'> <script type="text/javascript" src="javascript/javascript.js"></script> </head> <body class='home'> <div class='loginform'> <img id='imgavatar' src='$imgavatar'> <form method='post' action='index.php'> <input class = 'loginput' type='text' maxlength='16' name='user' value='$user' placeholder='Username'> <input class = 'loginput' type='password' maxlength='16' name='pass' value='$pass' placeholder='Password'> <h6 id='rememberme'><input type="checkbox" value="None" name="check" checked='checked' />Remember Me</h6> <span>$error<br></span> <input type='submit' value='Login'> </form> </div> <div class='signupform'> <h1 id='signhead'>Join Us!</h1> <p id='signhead'>It will be free and it will always be free!<br> Creat your own personal tree</p><br><br><br> <form method='POST' action='index.php'> <input class= 'loginput' type='text' maxlength='16' name='first' value='$userfirstname' placeholder='Name'> <input class= 'loginput' type='text' maxlength='16' name='lastname' value='$lastname' placeholder='Last Name'><br> <input class= 'loginput' type='email' maxlength='32'name='email' value='$email' placeholder='E-mail'> <input class= 'loginput' type='text' maxlength='16' name='username' value='$username' placeholder='Username' onBlur='checkUser(this)'><br> <input class= 'loginput' type='Password' maxlength='16' name='p' value='$password1' placeholder='Password'> <input class= 'loginput' type='Password' maxlength='16' name='p2' value='$password2' placeholder='Repeat Password'><br> <select name="month" onchange="call()" value='$bdm'> <option value="0">-Month-</option> <option value="1">January</option> <option value="2">February</option> <option value="3">March</option> <option value="4">April</option> <option value="5">May</option> <option value="6">Jun</option> <option value="7">July</option> <option value="8">August</option> <option value="9">September</option> <option value="10">October</option> <option value="11">November</option> <option value="12">December</option> </select> <select name="day" value='$bdd'> <option value="">-Day-</option> </select> <select name="year" onchange="call()" value='$bdy'> <option value="">-Year-</option> </select> $userfirstname $lastname <input type='submit' value='Sign Up'> </form> </div> </body> </html> _END; ?>