Click here to Skip to main content
14,699,089 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
<?php
if(isset($_POST['submit'])){
include_once 'dbh.inc.php';
$first = mysqli_real_escape_string($conn,$_POST['Fname']);
$email = mysqli_real_escape_string($conn,$_POST['email']);
$username = mysqli_real_escape_string($conn,$_POST['username']);
$pwd = mysqli_real_escape_string($conn,$_POST['password']);
$confirm = mysqli_real_escape_string($conn,$_POST['confirm']);
// error handlers

if ($pwd != $confirm) {
  header("Location: ../singup.php?notsame=");
  exit();
}

//check for empty fields
if(empty($first) || empty($email) || empty($username) || empty($pwd) || empty($confirm) ){
  header("Location: ../singup.php?empty=");
  exit();
}else{
  // check if the input characters are valid
if(!preg_match("/^[a-zA-Z]*$/",$first){
  header("Location: ../singup.php?invalid=");   <<<<error is here
  exit();
}else{
// check if emal is valid
if(filter_var(!$email, FILTER_VALIDATE_EMAIL)){
  header("Location: ../singup.php?emailno=");
  exit();
}else{
$sql = "SELECT * FROM users WHERE user_uid = '$username'";
$result = mysqli_query($conn,$sql);
$resultCheck = mysqli_num_rows($result);
if($resultCheck > 0){
  header("Location: ../singup.php?usertaken=");
  exit();
}else{


What I have tried:

i have searched the web for solutions but non worked
Posted
Updated 3-Nov-18 6:03am

1 solution

Missing close bracket in the line above:
   ----- Where is the matching one for this?
  |
  v
if(!preg_match("/^[a-zA-Z]*$/",$first){
  header("Location: ../singup.php?invalid=");
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900